home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / DTS Sample Code / Macintosh Sample Code / Monthly Releases (Compressed) / MacDTS.Sample.Code.89.06.sit / SC.001.Sample / Sample.p < prev    next >
MacBinary  |  1989-06-01  |  32.3 KB  |  [TEXT/MPS ]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
66% dexvert ZX81 Sinclair BASIC (image/sinclairBASIC) ext Supported
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, Thu Jun 1 15:56:27 1989, modified Thu Jun 1 15:56:27 1989, creator 'MPS ', type ASCII, 32467 bytes "Sample.p" , at 0x7f53 382 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MPS ]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 08 53 61 6d 70 6c 65 | 2e 70 00 00 00 00 00 00 |..Sample|.p......|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 50 53 | 20 00 00 00 00 00 00 00 |.TEXTMPS| .......|
|00000050| 00 00 00 00 00 7e d3 00 | 00 01 7e a0 ab 45 6b a0 |.....~..|..~..Ek.|
|00000060| ab 45 6b 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |.Ek.....|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 5f 69 00 00 |........|...._i..|
|00000080| 7b 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |{-------|--------|
|00000090| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000a0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000b0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|000000c0| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 0d |--------|-------.|
|000000d0| 23 0d 23 09 41 70 70 6c | 65 20 4d 61 63 69 6e 74 |#.#.Appl|e Macint|
|000000e0| 6f 73 68 20 44 65 76 65 | 6c 6f 70 65 72 20 54 65 |osh Deve|loper Te|
|000000f0| 63 68 6e 69 63 61 6c 20 | 53 75 70 70 6f 72 74 0d |chnical |Support.|
|00000100| 23 0d 23 09 4d 75 6c 74 | 69 46 69 6e 64 65 72 2d |#.#.Mult|iFinder-|
|00000110| 41 77 61 72 65 20 53 69 | 6d 70 6c 65 20 53 61 6d |Aware Si|mple Sam|
|00000120| 70 6c 65 20 41 70 70 6c | 69 63 61 74 69 6f 6e 0d |ple Appl|ication.|
|00000130| 23 0d 23 09 53 61 6d 70 | 6c 65 0d 23 0d 23 09 53 |#.#.Samp|le.#.#.S|
|00000140| 61 6d 70 6c 65 2e 70 09 | 2d 09 50 61 73 63 61 6c |ample.p.|-.Pascal|
|00000150| 20 53 6f 75 72 63 65 0d | 23 0d 23 09 43 6f 70 79 | Source.|#.#.Copy|
|00000160| 72 69 67 68 74 20 a9 20 | 31 39 38 39 20 41 70 70 |right . |1989 App|
|00000170| 6c 65 20 43 6f 6d 70 75 | 74 65 72 2c 20 49 6e 63 |le Compu|ter, Inc|
|00000180| 2e 0d 23 09 41 6c 6c 20 | 72 69 67 68 74 73 20 72 |..#.All |rights r|
|00000190| 65 73 65 72 76 65 64 2e | 0d 23 0d 23 09 56 65 72 |eserved.|.#.#.Ver|
|000001a0| 73 69 6f 6e 73 3a 09 0d | 23 09 09 09 09 31 2e 30 |sions:..|#....1.0|
|000001b0| 30 09 09 09 09 30 38 2f | 38 38 0d 23 09 09 09 09 |0....08/|88.#....|
|000001c0| 31 2e 30 31 09 09 09 09 | 31 31 2f 38 38 0d 23 09 |1.01....|11/88.#.|
|000001d0| 09 09 09 31 2e 30 32 09 | 09 09 09 30 34 2f 38 39 |...1.02.|...04/89|
|000001e0| 0d 23 09 09 09 09 31 2e | 30 33 09 09 09 09 30 36 |.#....1.|03....06|
|000001f0| 2f 38 39 0d 23 0d 23 09 | 43 6f 6d 70 6f 6e 65 6e |/89.#.#.|Componen|
|00000200| 74 73 3a 0d 23 09 09 09 | 09 53 61 6d 70 6c 65 2e |ts:.#...|.Sample.|
|00000210| 70 09 09 09 4a 75 6e 65 | 20 31 2c 20 31 39 38 39 |p...June| 1, 1989|
|00000220| 0d 23 09 09 09 09 53 61 | 6d 70 6c 65 2e 63 09 09 |.#....Sa|mple.c..|
|00000230| 09 4a 75 6e 65 20 31 2c | 20 31 39 38 39 0d 23 09 |.June 1,| 1989.#.|
|00000240| 09 09 09 53 61 6d 70 6c | 65 2e 61 09 09 09 4a 75 |...Sampl|e.a...Ju|
|00000250| 6e 65 20 31 2c 20 31 39 | 38 39 0d 23 09 09 09 09 |ne 1, 19|89.#....|
|00000260| 53 61 6d 70 6c 65 2e 69 | 6e 63 31 2e 61 09 09 4a |Sample.i|nc1.a..J|
|00000270| 75 6e 65 20 31 2c 20 31 | 39 38 39 0d 23 09 09 09 |une 1, 1|989.#...|
|00000280| 09 53 61 6d 70 6c 65 4d | 69 73 63 2e 61 09 09 4a |.SampleM|isc.a..J|
|00000290| 75 6e 65 20 31 2c 20 31 | 39 38 39 0d 23 09 09 09 |une 1, 1|989.#...|
|000002a0| 09 53 61 6d 70 6c 65 2e | 72 09 09 09 4a 75 6e 65 |.Sample.|r...June|
|000002b0| 20 31 2c 20 31 39 38 39 | 0d 23 09 09 09 09 53 61 | 1, 1989|.#....Sa|
|000002c0| 6d 70 6c 65 2e 68 09 09 | 09 4a 75 6e 65 20 31 2c |mple.h..|.June 1,|
|000002d0| 20 31 39 38 39 0d 23 09 | 09 09 09 50 53 61 6d 70 | 1989.#.|...PSamp|
|000002e0| 6c 65 2e 6d 61 6b 65 09 | 09 4a 75 6e 65 20 31 2c |le.make.|.June 1,|
|000002f0| 20 31 39 38 39 0d 23 09 | 09 09 09 43 53 61 6d 70 | 1989.#.|...CSamp|
|00000300| 6c 65 2e 6d 61 6b 65 09 | 09 4a 75 6e 65 20 31 2c |le.make.|.June 1,|
|00000310| 20 31 39 38 39 0d 23 09 | 09 09 09 41 53 61 6d 70 | 1989.#.|...ASamp|
|00000320| 6c 65 2e 6d 61 6b 65 09 | 09 4a 75 6e 65 20 31 2c |le.make.|.June 1,|
|00000330| 20 31 39 38 39 0d 23 0d | 23 09 53 61 6d 70 6c 65 | 1989.#.|#.Sample|
|00000340| 20 69 73 20 61 6e 20 65 | 78 61 6d 70 6c 65 20 61 | is an e|xample a|
|00000350| 70 70 6c 69 63 61 74 69 | 6f 6e 20 74 68 61 74 20 |pplicati|on that |
|00000360| 64 65 6d 6f 6e 73 74 72 | 61 74 65 73 20 68 6f 77 |demonstr|ates how|
|00000370| 20 74 6f 0d 23 09 69 6e | 69 74 69 61 6c 69 7a 65 | to.#.in|itialize|
|00000380| 20 74 68 65 20 63 6f 6d | 6d 6f 6e 6c 79 20 75 73 | the com|monly us|
|00000390| 65 64 20 74 6f 6f 6c 62 | 6f 78 20 6d 61 6e 61 67 |ed toolb|ox manag|
|000003a0| 65 72 73 2c 20 6f 70 65 | 72 61 74 65 20 0d 23 09 |ers, ope|rate .#.|
|000003b0| 73 75 63 63 65 73 73 66 | 75 6c 6c 79 20 75 6e 64 |successf|ully und|
|000003c0| 65 72 20 4d 75 6c 74 69 | 46 69 6e 64 65 72 2c 20 |er Multi|Finder, |
|000003d0| 68 61 6e 64 6c 65 20 64 | 65 73 6b 20 61 63 63 65 |handle d|esk acce|
|000003e0| 73 73 6f 72 69 65 73 2c | 20 0d 23 09 61 6e 64 20 |ssories,| .#.and |
|000003f0| 63 72 65 61 74 65 2c 20 | 67 72 6f 77 2c 20 61 6e |create, |grow, an|
|00000400| 64 20 7a 6f 6f 6d 20 77 | 69 6e 64 6f 77 73 2e 0d |d zoom w|indows..|
|00000410| 23 0d 23 09 49 74 20 64 | 6f 65 73 20 6e 6f 74 20 |#.#.It d|oes not |
|00000420| 62 79 20 61 6e 79 20 6d | 65 61 6e 73 20 64 65 6d |by any m|eans dem|
|00000430| 6f 6e 73 74 72 61 74 65 | 20 61 6c 6c 20 74 68 65 |onstrate| all the|
|00000440| 20 74 65 63 68 6e 69 71 | 75 65 73 20 0d 23 09 79 | techniq|ues .#.y|
|00000450| 6f 75 20 6e 65 65 64 20 | 66 6f 72 20 61 20 6c 61 |ou need |for a la|
|00000460| 72 67 65 20 61 70 70 6c | 69 63 61 74 69 6f 6e 2e |rge appl|ication.|
|00000470| 20 49 6e 20 70 61 72 74 | 69 63 75 6c 61 72 2c 20 | In part|icular, |
|00000480| 53 61 6d 70 6c 65 20 0d | 23 09 64 6f 65 73 20 6e |Sample .|#.does n|
|00000490| 6f 74 20 63 6f 76 65 72 | 20 65 78 63 65 70 74 69 |ot cover| excepti|
|000004a0| 6f 6e 20 68 61 6e 64 6c | 69 6e 67 2c 20 6d 75 6c |on handl|ing, mul|
|000004b0| 74 69 70 6c 65 20 77 69 | 6e 64 6f 77 73 2f 64 6f |tiple wi|ndows/do|
|000004c0| 63 75 6d 65 6e 74 73 2c | 20 0d 23 09 73 6f 70 68 |cuments,| .#.soph|
|000004d0| 69 73 74 69 63 61 74 65 | 64 20 6d 65 6d 6f 72 79 |isticate|d memory|
|000004e0| 20 6d 61 6e 61 67 65 6d | 65 6e 74 2c 20 70 72 69 | managem|ent, pri|
|000004f0| 6e 74 69 6e 67 2c 20 6f | 72 20 75 6e 64 6f 2e 20 |nting, o|r undo. |
|00000500| 41 6c 6c 20 6f 66 20 0d | 23 09 74 68 65 73 65 20 |All of .|#.these |
|00000510| 61 72 65 20 76 69 74 61 | 6c 20 70 61 72 74 73 20 |are vita|l parts |
|00000520| 6f 66 20 61 20 6e 6f 72 | 6d 61 6c 20 66 75 6c 6c |of a nor|mal full|
|00000530| 2d 73 69 7a 65 64 20 61 | 70 70 6c 69 63 61 74 69 |-sized a|pplicati|
|00000540| 6f 6e 2e 0d 23 0d 23 09 | 54 68 69 73 20 61 70 70 |on..#.#.|This app|
|00000550| 6c 69 63 61 74 69 6f 6e | 20 69 73 20 61 6e 20 65 |lication| is an e|
|00000560| 78 61 6d 70 6c 65 20 6f | 66 20 74 68 65 20 66 6f |xample o|f the fo|
|00000570| 72 6d 20 6f 66 20 61 20 | 4d 61 63 69 6e 74 6f 73 |rm of a |Macintos|
|00000580| 68 20 0d 23 09 61 70 70 | 6c 69 63 61 74 69 6f 6e |h .#.app|lication|
|00000590| 3b 20 69 74 20 69 73 20 | 4e 4f 54 20 61 20 74 65 |; it is |NOT a te|
|000005a0| 6d 70 6c 61 74 65 2e 20 | 49 74 20 69 73 20 4e 4f |mplate. |It is NO|
|000005b0| 54 20 69 6e 74 65 6e 64 | 65 64 20 74 6f 20 62 65 |T intend|ed to be|
|000005c0| 20 0d 23 09 75 73 65 64 | 20 61 73 20 61 20 66 6f | .#.used| as a fo|
|000005d0| 75 6e 64 61 74 69 6f 6e | 20 66 6f 72 20 74 68 65 |undation| for the|
|000005e0| 20 6e 65 78 74 20 77 6f | 72 6c 64 2d 63 6c 61 73 | next wo|rld-clas|
|000005f0| 73 2c 20 62 65 73 74 2d | 73 65 6c 6c 69 6e 67 2c |s, best-|selling,|
|00000600| 20 0d 23 09 36 30 30 4b | 20 61 70 70 6c 69 63 61 | .#.600K| applica|
|00000610| 74 69 6f 6e 2e 20 41 20 | 73 74 69 63 6b 20 66 69 |tion. A |stick fi|
|00000620| 67 75 72 65 20 64 72 61 | 77 69 6e 67 20 6f 66 20 |gure dra|wing of |
|00000630| 74 68 65 20 68 75 6d 61 | 6e 20 62 6f 64 79 20 6d |the huma|n body m|
|00000640| 61 79 20 0d 23 09 62 65 | 20 61 20 67 6f 6f 64 20 |ay .#.be| a good |
|00000650| 65 78 61 6d 70 6c 65 20 | 6f 66 20 74 68 65 20 66 |example |of the f|
|00000660| 6f 72 6d 20 66 6f 72 20 | 61 20 70 61 69 6e 74 69 |orm for |a painti|
|00000670| 6e 67 2c 20 62 75 74 20 | 74 68 61 74 20 64 6f 65 |ng, but |that doe|
|00000680| 73 20 6e 6f 74 20 0d 23 | 09 6d 65 61 6e 20 69 74 |s not .#|.mean it|
|00000690| 20 73 68 6f 75 6c 64 20 | 62 65 20 75 73 65 64 20 | should |be used |
|000006a0| 61 73 20 74 68 65 20 62 | 61 73 69 73 20 66 6f 72 |as the b|asis for|
|000006b0| 20 74 68 65 20 6e 65 78 | 74 20 4d 6f 6e 61 20 4c | the nex|t Mona L|
|000006c0| 69 73 61 2e 0d 23 0d 23 | 09 57 65 20 72 65 63 6f |isa..#.#|.We reco|
|000006d0| 6d 6d 65 6e 64 20 74 68 | 61 74 20 79 6f 75 20 72 |mmend th|at you r|
|000006e0| 65 76 69 65 77 20 74 68 | 69 73 20 70 72 6f 67 72 |eview th|is progr|
|000006f0| 61 6d 20 6f 72 20 54 45 | 53 61 6d 70 6c 65 20 62 |am or TE|Sample b|
|00000700| 65 66 6f 72 65 20 0d 23 | 09 62 65 67 69 6e 6e 69 |efore .#|.beginni|
|00000710| 6e 67 20 61 20 6e 65 77 | 20 61 70 70 6c 69 63 61 |ng a new| applica|
|00000720| 74 69 6f 6e 2e 0d 23 0d | 2d 2d 2d 2d 2d 2d 2d 2d |tion..#.|--------|
|00000730| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000740| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000750| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000760| 2d 2d 2d 2d 2d 2d 2d 2d | 2d 2d 2d 2d 2d 2d 2d 2d |--------|--------|
|00000770| 2d 2d 2d 2d 2d 2d 7d 0d | 0d 0d 50 52 4f 47 52 41 |------}.|..PROGRA|
|00000780| 4d 20 53 61 6d 70 6c 65 | 3b 0d 0d 0d 7b 53 65 67 |M Sample|;...{Seg|
|00000790| 6d 65 6e 74 61 74 69 6f | 6e 20 73 74 72 61 74 65 |mentatio|n strate|
|000007a0| 67 79 3a 0d 0d 20 54 68 | 69 73 20 70 72 6f 67 72 |gy:.. Th|is progr|
|000007b0| 61 6d 20 63 6f 6e 73 69 | 73 74 73 20 6f 66 20 74 |am consi|sts of t|
|000007c0| 68 72 65 65 20 73 65 67 | 6d 65 6e 74 73 2e 20 4d |hree seg|ments. M|
|000007d0| 61 69 6e 20 63 6f 6e 74 | 61 69 6e 73 20 6d 6f 73 |ain cont|ains mos|
|000007e0| 74 20 6f 66 20 74 68 65 | 20 63 6f 64 65 2c 0d 20 |t of the| code,. |
|000007f0| 69 6e 63 6c 75 64 69 6e | 67 20 74 68 65 20 4d 50 |includin|g the MP|
|00000800| 57 20 6c 69 62 72 61 72 | 69 65 73 2c 20 61 6e 64 |W librar|ies, and|
|00000810| 20 74 68 65 20 6d 61 69 | 6e 20 70 72 6f 67 72 61 | the mai|n progra|
|00000820| 6d 2e 20 49 6e 69 74 69 | 61 6c 69 7a 65 20 63 6f |m. Initi|alize co|
|00000830| 6e 74 61 69 6e 73 0d 20 | 63 6f 64 65 20 74 68 61 |ntains. |code tha|
|00000840| 74 20 69 73 20 6f 6e 6c | 79 20 75 73 65 64 20 6f |t is onl|y used o|
|00000850| 6e 63 65 2c 20 64 75 72 | 69 6e 67 20 73 74 61 72 |nce, dur|ing star|
|00000860| 74 75 70 2c 20 61 6e 64 | 20 63 61 6e 20 62 65 20 |tup, and| can be |
|00000870| 75 6e 6c 6f 61 64 65 64 | 20 61 66 74 65 72 20 74 |unloaded| after t|
|00000880| 68 65 0d 20 70 72 6f 67 | 72 61 6d 20 73 74 61 72 |he. prog|ram star|
|00000890| 74 73 2e 20 25 41 35 49 | 6e 69 74 20 69 73 20 61 |ts. %A5I|nit is a|
|000008a0| 75 74 6f 6d 61 74 69 63 | 61 6c 6c 79 20 63 72 65 |utomatic|ally cre|
|000008b0| 61 74 65 64 20 62 79 20 | 74 68 65 20 4c 69 6e 6b |ated by |the Link|
|000008c0| 65 72 20 74 6f 20 69 6e | 69 74 69 61 6c 69 7a 65 |er to in|itialize|
|000008d0| 0d 20 67 6c 6f 62 61 6c | 73 20 66 6f 72 20 74 68 |. global|s for th|
|000008e0| 65 20 4d 50 57 20 6c 69 | 62 72 61 72 69 65 73 20 |e MPW li|braries |
|000008f0| 61 6e 64 20 69 73 20 75 | 6e 6c 6f 61 64 65 64 20 |and is u|nloaded |
|00000900| 72 69 67 68 74 20 61 77 | 61 79 2e 7d 0d 0d 0d 7b |right aw|ay.}...{|
|00000910| 53 65 74 50 6f 72 74 20 | 73 74 72 61 74 65 67 79 |SetPort |strategy|
|00000920| 3a 0d 0d 20 54 6f 6f 6c | 62 6f 78 20 72 6f 75 74 |:.. Tool|box rout|
|00000930| 69 6e 65 73 20 64 6f 20 | 6e 6f 74 20 63 68 61 6e |ines do |not chan|
|00000940| 67 65 20 74 68 65 20 63 | 75 72 72 65 6e 74 20 70 |ge the c|urrent p|
|00000950| 6f 72 74 2e 20 49 6e 20 | 73 70 69 74 65 20 6f 66 |ort. In |spite of|
|00000960| 20 74 68 69 73 2c 20 69 | 6e 20 74 68 69 73 0d 20 | this, i|n this. |
|00000970| 70 72 6f 67 72 61 6d 20 | 77 65 20 75 73 65 20 61 |program |we use a|
|00000980| 20 73 74 72 61 74 65 67 | 79 20 6f 66 20 63 61 6c | strateg|y of cal|
|00000990| 6c 69 6e 67 20 53 65 74 | 50 6f 72 74 20 77 68 65 |ling Set|Port whe|
|000009a0| 6e 65 76 65 72 20 77 65 | 20 77 61 6e 74 20 74 6f |never we| want to|
|000009b0| 20 64 72 61 77 20 6f 72 | 0d 20 6d 61 6b 65 20 63 | draw or|. make c|
|000009c0| 61 6c 6c 73 20 77 68 69 | 63 68 20 64 65 70 65 6e |alls whi|ch depen|
|000009d0| 64 20 6f 6e 20 74 68 65 | 20 63 75 72 72 65 6e 74 |d on the| current|
|000009e0| 20 70 6f 72 74 2e 20 54 | 68 69 73 20 6d 61 6b 65 | port. T|his make|
|000009f0| 73 20 75 73 20 6c 65 73 | 73 20 76 75 6c 6e 65 72 |s us les|s vulner|
|00000a00| 61 62 6c 65 0d 20 74 6f | 20 62 75 67 73 20 69 6e |able. to| bugs in|
|00000a10| 20 6f 74 68 65 72 20 73 | 6f 66 74 77 61 72 65 20 | other s|oftware |
|00000a20| 77 68 69 63 68 20 6d 69 | 67 68 74 20 61 6c 74 65 |which mi|ght alte|
|00000a30| 72 20 74 68 65 20 63 75 | 72 72 65 6e 74 20 70 6f |r the cu|rrent po|
|00000a40| 72 74 20 28 73 75 63 68 | 20 61 73 20 74 68 65 0d |rt (such| as the.|
|00000a50| 20 62 75 67 20 28 66 65 | 61 74 75 72 65 3f 29 20 | bug (fe|ature?) |
|00000a60| 69 6e 20 6d 61 6e 79 20 | 64 65 73 6b 20 61 63 63 |in many |desk acc|
|00000a70| 65 73 73 6f 72 69 65 73 | 20 77 68 69 63 68 20 63 |essories| which c|
|00000a80| 68 61 6e 67 65 20 74 68 | 65 20 70 6f 72 74 20 6f |hange th|e port o|
|00000a90| 6e 20 4f 70 65 6e 44 65 | 73 6b 41 63 63 29 2e 0d |n OpenDe|skAcc)..|
|00000aa0| 20 48 6f 70 65 66 75 6c | 6c 79 2c 20 74 68 69 73 | Hopeful|ly, this|
|00000ab0| 20 61 6c 73 6f 20 6d 61 | 6b 65 73 20 74 68 65 20 | also ma|kes the |
|00000ac0| 72 6f 75 74 69 6e 65 73 | 20 66 72 6f 6d 20 74 68 |routines| from th|
|00000ad0| 69 73 20 70 72 6f 67 72 | 61 6d 20 6d 6f 72 65 20 |is progr|am more |
|00000ae0| 73 65 6c 66 2d 63 6f 6e | 74 61 69 6e 65 64 2c 0d |self-con|tained,.|
|00000af0| 20 73 69 6e 63 65 20 74 | 68 65 79 20 64 6f 6e 27 | since t|hey don'|
|00000b00| 74 20 64 65 70 65 6e 64 | 20 6f 6e 20 74 68 65 20 |t depend| on the |
|00000b10| 63 75 72 72 65 6e 74 20 | 70 6f 72 74 20 73 65 74 |current |port set|
|00000b20| 74 69 6e 67 2e 7d 0d 0d | 0d 55 53 45 53 0d 09 4d |ting.}..|.USES..M|
|00000b30| 65 6d 54 79 70 65 73 2c | 20 51 75 69 63 6b 44 72 |emTypes,| QuickDr|
|00000b40| 61 77 2c 20 4f 53 49 6e | 74 66 2c 20 54 6f 6f 6c |aw, OSIn|tf, Tool|
|00000b50| 49 6e 74 66 2c 20 50 61 | 63 6b 49 6e 74 66 2c 20 |Intf, Pa|ckIntf, |
|00000b60| 54 72 61 70 73 3b 0d 0d | 43 4f 4e 53 54 0d 09 7b |Traps;..|CONST..{|
|00000b70| 4d 50 57 20 33 2e 30 20 | 77 69 6c 6c 20 69 6e 63 |MPW 3.0 |will inc|
|00000b80| 6c 75 64 65 20 61 20 54 | 72 61 70 73 2e 70 20 69 |lude a T|raps.p i|
|00000b90| 6e 74 65 72 66 61 63 65 | 20 66 69 6c 65 20 74 68 |nterface| file th|
|00000ba0| 61 74 20 69 6e 63 6c 75 | 64 65 73 20 63 6f 6e 73 |at inclu|des cons|
|00000bb0| 74 61 6e 74 73 20 66 6f | 72 20 74 72 61 70 20 6e |tants fo|r trap n|
|00000bc0| 75 6d 62 65 72 73 2e 0d | 09 20 54 68 65 73 65 20 |umbers..|. These |
|00000bd0| 63 6f 6e 73 74 61 6e 74 | 73 20 61 72 65 20 66 72 |constant|s are fr|
|00000be0| 6f 6d 20 74 68 61 74 20 | 66 69 6c 65 2e 7d 0d 09 |om that |file.}..|
|00000bf0| 7b 31 2e 30 32 20 2d 20 | 73 69 6e 63 65 20 75 73 |{1.02 - |since us|
|00000c00| 69 6e 67 20 4d 50 57 20 | 33 2e 30 20 6f 6e 6c 79 |ing MPW |3.0 only|
|00000c10| 2c 20 77 65 20 69 6e 63 | 6c 75 64 65 20 54 72 61 |, we inc|lude Tra|
|00000c20| 70 73 2e 70 2c 20 73 6f | 20 77 65 20 6e 6f 77 20 |ps.p, so| we now |
|00000c30| 68 61 76 65 20 74 72 61 | 70 20 6e 75 6d 62 65 72 |have tra|p number|
|00000c40| 73 2e 7d 0d 0d 09 7b 31 | 2e 30 31 20 2d 20 63 68 |s.}...{1|.01 - ch|
|00000c50| 61 6e 67 65 64 20 63 6f | 6e 73 74 61 6e 74 73 20 |anged co|nstants |
|00000c60| 74 6f 20 62 65 67 69 6e | 20 77 69 74 68 20 27 6b |to begin| with 'k|
|00000c70| 27 20 66 6f 72 20 63 6f | 6e 73 69 73 74 65 6e 63 |' for co|nsistenc|
|00000c80| 79 2c 20 65 78 63 65 70 | 74 20 66 6f 72 20 72 65 |y, excep|t for re|
|00000c90| 73 6f 75 72 63 65 20 49 | 44 73 7d 0d 09 7b 53 79 |source I|Ds}..{Sy|
|00000ca0| 73 45 6e 76 69 72 6f 6e | 73 56 65 72 73 69 6f 6e |sEnviron|sVersion|
|00000cb0| 20 69 73 20 70 61 73 73 | 65 64 20 74 6f 20 53 79 | is pass|ed to Sy|
|00000cc0| 73 45 6e 76 69 72 6f 6e | 73 20 74 6f 20 74 65 6c |sEnviron|s to tel|
|00000cd0| 6c 20 69 74 20 77 68 69 | 63 68 20 76 65 72 73 69 |l it whi|ch versi|
|00000ce0| 6f 6e 20 6f 66 20 74 68 | 65 0d 09 20 53 79 73 45 |on of th|e.. SysE|
|00000cf0| 6e 76 52 65 63 20 77 65 | 20 75 6e 64 65 72 73 74 |nvRec we| underst|
|00000d00| 61 6e 64 2e 7d 0d 09 6b | 53 79 73 45 6e 76 69 72 |and.}..k|SysEnvir|
|00000d10| 6f 6e 73 56 65 72 73 69 | 6f 6e 09 09 3d 20 31 3b |onsVersi|on..= 1;|
|00000d20| 0d 0d 09 7b 4f 53 45 76 | 65 6e 74 20 69 73 20 74 |...{OSEv|ent is t|
|00000d30| 68 65 20 65 76 65 6e 74 | 20 6e 75 6d 62 65 72 20 |he event| number |
|00000d40| 6f 66 20 74 68 65 20 73 | 75 73 70 65 6e 64 2f 72 |of the s|uspend/r|
|00000d50| 65 73 75 6d 65 20 61 6e | 64 20 6d 6f 75 73 65 2d |esume an|d mouse-|
|00000d60| 6d 6f 76 65 64 20 65 76 | 65 6e 74 73 20 73 65 6e |moved ev|ents sen|
|00000d70| 74 0d 09 20 62 79 20 4d | 75 6c 74 69 46 69 6e 64 |t.. by M|ultiFind|
|00000d80| 65 72 2e 20 4f 6e 63 65 | 20 77 65 20 64 65 74 65 |er. Once| we dete|
|00000d90| 72 6d 69 6e 65 20 74 68 | 61 74 20 61 6e 20 65 76 |rmine th|at an ev|
|00000da0| 65 6e 74 20 69 73 20 61 | 6e 20 6f 73 45 76 65 6e |ent is a|n osEven|
|00000db0| 74 2c 20 77 65 20 6c 6f | 6f 6b 20 61 74 20 74 68 |t, we lo|ok at th|
|00000dc0| 65 0d 09 20 68 69 67 68 | 20 62 79 74 65 20 6f 66 |e.. high| byte of|
|00000dd0| 20 74 68 65 20 6d 65 73 | 73 61 67 65 20 73 65 6e | the mes|sage sen|
|00000de0| 74 20 74 6f 20 64 65 74 | 65 72 6d 69 6e 65 20 77 |t to det|ermine w|
|00000df0| 68 69 63 68 20 6b 69 6e | 64 20 69 74 20 69 73 2e |hich kin|d it is.|
|00000e00| 20 54 6f 20 64 69 66 66 | 65 72 65 6e 74 69 61 74 | To diff|erentiat|
|00000e10| 65 0d 09 20 73 75 73 70 | 65 6e 64 20 61 6e 64 20 |e.. susp|end and |
|00000e20| 72 65 73 75 6d 65 20 65 | 76 65 6e 74 73 20 77 65 |resume e|vents we|
|00000e30| 20 63 68 65 63 6b 20 74 | 68 65 20 72 65 73 75 6d | check t|he resum|
|00000e40| 65 4d 61 73 6b 20 62 69 | 74 2e 7d 0d 09 6b 4f 53 |eMask bi|t.}..kOS|
|00000e50| 45 76 65 6e 74 09 09 09 | 09 3d 20 61 70 70 34 45 |Event...|.= app4E|
|00000e60| 76 74 3b 09 7b 65 76 65 | 6e 74 20 75 73 65 64 20 |vt;.{eve|nt used |
|00000e70| 62 79 20 4d 75 6c 74 69 | 46 69 6e 64 65 72 7d 0d |by Multi|Finder}.|
|00000e80| 09 6b 53 75 73 70 65 6e | 64 52 65 73 75 6d 65 4d |.kSuspen|dResumeM|
|00000e90| 65 73 73 61 67 65 09 3d | 20 31 3b 09 09 7b 68 69 |essage.=| 1;..{hi|
|00000ea0| 67 68 20 62 79 74 65 20 | 6f 66 20 73 75 73 70 65 |gh byte |of suspe|
|00000eb0| 6e 64 2f 72 65 73 75 6d | 65 20 65 76 65 6e 74 20 |nd/resum|e event |
|00000ec0| 6d 65 73 73 61 67 65 7d | 0d 09 6b 52 65 73 75 6d |message}|..kResum|
|00000ed0| 65 4d 61 73 6b 09 09 09 | 09 3d 20 31 3b 09 09 7b |eMask...|.= 1;..{|
|00000ee0| 62 69 74 20 6f 66 20 6d | 65 73 73 61 67 65 20 66 |bit of m|essage f|
|00000ef0| 69 65 6c 64 20 66 6f 72 | 20 72 65 73 75 6d 65 20 |ield for| resume |
|00000f00| 76 73 2e 20 73 75 73 70 | 65 6e 64 7d 0d 09 6b 4e |vs. susp|end}..kN|
|00000f10| 6f 45 76 65 6e 74 73 09 | 09 09 09 3d 20 30 3b 09 |oEvents.|...= 0;.|
|00000f20| 09 7b 6e 6f 20 65 76 65 | 6e 74 73 20 6d 61 73 6b |.{no eve|nts mask|
|00000f30| 7d 0d 0d 09 7b 31 2e 30 | 31 20 2d 20 6b 4d 69 6e |}...{1.0|1 - kMin|
|00000f40| 48 65 61 70 20 2d 20 54 | 68 69 73 20 69 73 20 74 |Heap - T|his is t|
|00000f50| 68 65 20 6d 69 6e 69 6d | 75 6d 20 72 65 73 75 6c |he minim|um resul|
|00000f60| 74 20 66 72 6f 6d 20 74 | 68 65 20 66 6f 6c 6c 6f |t from t|he follo|
|00000f70| 77 69 6e 67 0d 09 20 65 | 71 75 61 74 69 6f 6e 3a |wing.. e|quation:|
|00000f80| 0d 09 09 09 0d 09 09 09 | 4f 52 44 28 47 65 74 41 |........|ORD(GetA|
|00000f90| 70 70 6c 4c 69 6d 69 74 | 29 20 2d 20 4f 52 44 28 |pplLimit|) - ORD(|
|00000fa0| 41 70 70 6c 69 63 5a 6f | 6e 65 29 0d 09 09 09 0d |ApplicZo|ne).....|
|00000fb0| 09 20 66 6f 72 20 74 68 | 65 20 61 70 70 6c 69 63 |. for th|e applic|
|00000fc0| 61 74 69 6f 6e 20 74 6f | 20 72 75 6e 2e 20 49 74 |ation to| run. It|
|00000fd0| 20 77 69 6c 6c 20 69 6e | 73 75 72 65 20 74 68 61 | will in|sure tha|
|00000fe0| 74 20 65 6e 6f 75 67 68 | 20 6d 65 6d 6f 72 79 20 |t enough| memory |
|00000ff0| 77 69 6c 6c 0d 09 20 62 | 65 20 61 72 6f 75 6e 64 |will.. b|e around|
|00001000| 20 66 6f 72 20 72 65 61 | 73 6f 6e 61 62 6c 65 2d | for rea|sonable-|
|00001010| 73 69 7a 65 64 20 73 63 | 72 61 70 73 2c 20 46 4b |sized sc|raps, FK|
|00001020| 45 59 73 2c 20 65 74 63 | 2e 20 74 6f 20 65 78 69 |EYs, etc|. to exi|
|00001030| 73 74 20 77 69 74 68 20 | 74 68 65 0d 09 20 61 70 |st with |the.. ap|
|00001040| 70 6c 69 63 61 74 69 6f | 6e 2c 20 61 6e 64 20 73 |plicatio|n, and s|
|00001050| 74 69 6c 6c 20 67 69 76 | 65 20 74 68 65 20 61 70 |till giv|e the ap|
|00001060| 70 6c 69 63 61 74 69 6f | 6e 20 73 6f 6d 65 20 27 |plicatio|n some '|
|00001070| 62 72 65 61 74 68 69 6e | 67 20 72 6f 6f 6d 27 2e |breathin|g room'.|
|00001080| 0d 09 20 54 6f 20 64 65 | 72 69 76 65 20 74 68 69 |.. To de|rive thi|
|00001090| 73 20 6e 75 6d 62 65 72 | 2c 20 77 65 20 72 61 6e |s number|, we ran|
|000010a0| 20 75 6e 64 65 72 20 61 | 20 4d 75 6c 74 69 46 69 | under a| MultiFi|
|000010b0| 6e 64 65 72 20 70 61 72 | 74 69 74 69 6f 6e 20 74 |nder par|tition t|
|000010c0| 68 61 74 20 77 61 73 0d | 09 20 6f 75 72 20 72 65 |hat was.|. our re|
|000010d0| 71 75 65 73 74 65 64 20 | 6d 69 6e 69 6d 75 6d 20 |quested |minimum |
|000010e0| 73 69 7a 65 2c 20 61 73 | 20 67 69 76 65 6e 20 69 |size, as| given i|
|000010f0| 6e 20 74 68 65 20 27 53 | 49 5a 45 27 20 72 65 73 |n the 'S|IZE' res|
|00001100| 6f 75 72 63 65 2e 7d 0d | 09 20 0d 09 6b 4d 69 6e |ource.}.|. ..kMin|
|00001110| 48 65 61 70 09 3d 20 32 | 31 20 2a 20 31 30 32 34 |Heap.= 2|1 * 1024|
|00001120| 3b 0d 09 0d 09 7b 31 2e | 30 31 20 2d 20 6b 4d 69 |;....{1.|01 - kMi|
|00001130| 6e 53 70 61 63 65 20 2d | 20 54 68 69 73 20 69 73 |nSpace -| This is|
|00001140| 20 74 68 65 20 6d 69 6e | 69 6d 75 6d 20 72 65 73 | the min|imum res|
|00001150| 75 6c 74 20 66 72 6f 6d | 20 50 75 72 67 65 53 70 |ult from| PurgeSp|
|00001160| 61 63 65 2c 20 77 68 65 | 6e 20 63 61 6c 6c 65 64 |ace, whe|n called|
|00001170| 0d 09 20 61 74 20 69 6e | 69 74 69 61 6c 69 7a 61 |.. at in|itializa|
|00001180| 74 69 6f 6e 20 74 69 6d | 65 2c 20 66 6f 72 20 74 |tion tim|e, for t|
|00001190| 68 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 74 |he appli|cation t|
|000011a0| 6f 20 72 75 6e 2e 20 54 | 68 69 73 20 6e 75 6d 62 |o run. T|his numb|
|000011b0| 65 72 20 61 63 74 73 0d | 09 20 61 73 20 61 20 64 |er acts.|. as a d|
|000011c0| 6f 75 62 6c 65 2d 63 68 | 65 63 6b 20 74 6f 20 69 |ouble-ch|eck to i|
|000011d0| 6e 73 75 72 65 20 74 68 | 61 74 20 74 68 65 72 65 |nsure th|at there|
|000011e0| 20 72 65 61 6c 6c 79 20 | 69 73 20 65 6e 6f 75 67 | really |is enoug|
|000011f0| 68 20 6d 65 6d 6f 72 79 | 20 66 6f 72 20 74 68 65 |h memory| for the|
|00001200| 0d 09 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 74 |.. appli|cation t|
|00001210| 6f 20 72 75 6e 2c 20 69 | 6e 63 6c 75 64 69 6e 67 |o run, i|ncluding|
|00001220| 20 77 68 61 74 20 68 61 | 73 20 62 65 65 6e 20 74 | what ha|s been t|
|00001230| 61 6b 65 6e 20 75 70 20 | 61 6c 72 65 61 64 79 20 |aken up |already |
|00001240| 62 79 0d 09 20 70 72 65 | 2d 6c 6f 61 64 65 64 20 |by.. pre|-loaded |
|00001250| 72 65 73 6f 75 72 63 65 | 73 2c 20 74 68 65 20 73 |resource|s, the s|
|00001260| 63 72 61 70 2c 20 63 6f | 64 65 2c 20 61 6e 64 20 |crap, co|de, and |
|00001270| 6f 74 68 65 72 20 73 75 | 6e 64 72 79 20 6d 65 6d |other su|ndry mem|
|00001280| 6f 72 79 20 62 6c 6f 63 | 6b 73 2e 7d 0d 09 20 0d |ory bloc|ks.}.. .|
|00001290| 09 6b 4d 69 6e 53 70 61 | 63 65 09 3d 20 38 20 2a |.kMinSpa|ce.= 8 *|
|000012a0| 20 31 30 32 34 3b 0d 09 | 0d 09 7b 6b 45 78 74 72 | 1024;..|..{kExtr|
|000012b0| 65 6d 65 4e 65 67 20 61 | 6e 64 20 6b 45 78 74 72 |emeNeg a|nd kExtr|
|000012c0| 65 6d 65 50 6f 73 20 61 | 72 65 20 75 73 65 64 20 |emePos a|re used |
|000012d0| 74 6f 20 73 65 74 20 75 | 70 20 77 69 64 65 20 6f |to set u|p wide o|
|000012e0| 70 65 6e 20 72 65 63 74 | 61 6e 67 6c 65 73 20 61 |pen rect|angles a|
|000012f0| 6e 64 20 72 65 67 69 6f | 6e 73 2e 7d 0d 09 6b 45 |nd regio|ns.}..kE|
|00001300| 78 74 72 65 6d 65 4e 65 | 67 09 3d 20 2d 33 32 37 |xtremeNe|g.= -327|
|00001310| 36 38 3b 0d 09 6b 45 78 | 74 72 65 6d 65 50 6f 73 |68;..kEx|tremePos|
|00001320| 09 3d 20 33 32 37 36 37 | 20 2d 20 31 3b 09 09 09 |.= 32767| - 1;...|
|00001330| 7b 72 65 71 75 69 72 65 | 64 20 66 6f 72 20 6f 6c |{require|d for ol|
|00001340| 64 20 72 65 67 69 6f 6e | 20 62 75 67 7d 0d 09 0d |d region| bug}...|
|00001350| 09 7b 54 68 65 20 66 6f | 6c 6c 6f 77 69 6e 67 20 |.{The fo|llowing |
|00001360| 63 6f 6e 73 74 61 6e 74 | 73 20 61 72 65 20 61 6c |constant|s are al|
|00001370| 6c 20 72 65 73 6f 75 72 | 63 65 20 49 44 73 2c 20 |l resour|ce IDs, |
|00001380| 63 6f 72 72 65 73 70 6f | 6e 64 69 6e 67 20 74 6f |correspo|nding to|
|00001390| 20 72 65 73 6f 75 72 63 | 65 73 20 69 6e 20 53 61 | resourc|es in Sa|
|000013a0| 6d 70 6c 65 2e 72 2e 7d | 0d 09 72 4d 65 6e 75 42 |mple.r.}|..rMenuB|
|000013b0| 61 72 09 3d 20 31 32 38 | 3b 09 09 09 09 09 7b 61 |ar.= 128|;.....{a|
|000013c0| 70 70 6c 69 63 61 74 69 | 6f 6e 27 73 20 6d 65 6e |pplicati|on's men|
|000013d0| 75 20 62 61 72 7d 0d 09 | 72 41 62 6f 75 74 41 6c |u bar}..|rAboutAl|
|000013e0| 65 72 74 09 3d 20 31 32 | 38 3b 09 09 09 09 09 7b |ert.= 12|8;.....{|
|000013f0| 61 62 6f 75 74 20 61 6c | 65 72 74 7d 0d 09 72 55 |about al|ert}..rU|
|00001400| 73 65 72 41 6c 65 72 74 | 09 3d 20 31 32 39 3b 09 |serAlert|.= 129;.|
|00001410| 09 09 09 09 7b 65 72 72 | 6f 72 20 75 73 65 72 20 |....{err|or user |
|00001420| 61 6c 65 72 74 7d 0d 09 | 72 57 69 6e 64 6f 77 09 |alert}..|rWindow.|
|00001430| 09 3d 20 31 32 38 3b 09 | 09 09 09 09 7b 61 70 70 |.= 128;.|....{app|
|00001440| 6c 69 63 61 74 69 6f 6e | 27 73 20 77 69 6e 64 6f |lication|'s windo|
|00001450| 77 7d 0d 09 72 53 74 6f | 70 52 65 63 74 09 3d 20 |w}..rSto|pRect.= |
|00001460| 31 32 38 3b 09 09 09 09 | 09 7b 72 65 63 74 61 6e |128;....|.{rectan|
|00001470| 67 6c 65 20 66 6f 72 20 | 53 74 6f 70 20 6c 69 67 |gle for |Stop lig|
|00001480| 68 74 7d 0d 09 72 47 6f | 52 65 63 74 09 09 3d 20 |ht}..rGo|Rect..= |
|00001490| 31 32 39 3b 09 09 09 09 | 09 7b 72 65 63 74 61 6e |129;....|.{rectan|
|000014a0| 67 6c 65 20 66 6f 72 20 | 47 6f 20 6c 69 67 68 74 |gle for |Go light|
|000014b0| 7d 0d 0d 09 7b 54 68 65 | 20 66 6f 6c 6c 6f 77 69 |}...{The| followi|
|000014c0| 6e 67 20 63 6f 6e 73 74 | 61 6e 74 73 20 61 72 65 |ng const|ants are|
|000014d0| 20 75 73 65 64 20 74 6f | 20 69 64 65 6e 74 69 66 | used to| identif|
|000014e0| 79 20 6d 65 6e 75 73 20 | 61 6e 64 20 74 68 65 69 |y menus |and thei|
|000014f0| 72 20 69 74 65 6d 73 2e | 20 54 68 65 20 6d 65 6e |r items.| The men|
|00001500| 75 20 49 44 73 0d 09 20 | 68 61 76 65 20 61 6e 20 |u IDs.. |have an |
|00001510| 22 6d 22 20 70 72 65 66 | 69 78 20 61 6e 64 20 74 |"m" pref|ix and t|
|00001520| 68 65 20 69 74 65 6d 20 | 6e 75 6d 62 65 72 73 20 |he item |numbers |
|00001530| 77 69 74 68 69 6e 20 65 | 61 63 68 20 6d 65 6e 75 |within e|ach menu|
|00001540| 20 68 61 76 65 20 61 6e | 20 22 69 22 20 70 72 65 | have an| "i" pre|
|00001550| 66 69 78 2e 7d 0d 09 6d | 41 70 70 6c 65 09 09 3d |fix.}..m|Apple..=|
|00001560| 20 31 32 38 3b 09 09 09 | 09 09 7b 41 70 70 6c 65 | 128;...|..{Apple|
|00001570| 20 6d 65 6e 75 7d 0d 09 | 69 41 62 6f 75 74 09 09 | menu}..|iAbout..|
|00001580| 3d 20 31 3b 0d 0d 09 6d | 46 69 6c 65 09 09 3d 20 |= 1;...m|File..= |
|00001590| 31 32 39 3b 09 09 09 09 | 09 7b 46 69 6c 65 20 6d |129;....|.{File m|
|000015a0| 65 6e 75 7d 0d 09 69 4e | 65 77 09 09 3d 20 31 3b |enu}..iN|ew..= 1;|
|000015b0| 0d 09 69 43 6c 6f 73 65 | 09 09 3d 20 34 3b 0d 09 |..iClose|..= 4;..|
|000015c0| 69 51 75 69 74 09 09 3d | 20 31 32 3b 0d 0d 09 6d |iQuit..=| 12;...m|
|000015d0| 45 64 69 74 09 09 3d 20 | 31 33 30 3b 09 09 09 09 |Edit..= |130;....|
|000015e0| 09 7b 45 64 69 74 20 6d | 65 6e 75 7d 0d 09 69 55 |.{Edit m|enu}..iU|
|000015f0| 6e 64 6f 09 09 3d 20 31 | 3b 0d 09 69 43 75 74 09 |ndo..= 1|;..iCut.|
|00001600| 09 3d 20 33 3b 0d 09 69 | 43 6f 70 79 09 09 3d 20 |.= 3;..i|Copy..= |
|00001610| 34 3b 0d 09 69 50 61 73 | 74 65 09 09 3d 20 35 3b |4;..iPas|te..= 5;|
|00001620| 0d 09 69 43 6c 65 61 72 | 09 09 3d 20 36 3b 0d 0d |..iClear|..= 6;..|
|00001630| 09 6d 4c 69 67 68 74 09 | 09 3d 20 31 33 31 3b 09 |.mLight.|.= 131;.|
|00001640| 09 09 09 09 7b 4c 69 67 | 68 74 20 6d 65 6e 75 7d |....{Lig|ht menu}|
|00001650| 0d 09 69 53 74 6f 70 09 | 09 3d 20 31 3b 0d 09 69 |..iStop.|.= 1;..i|
|00001660| 47 6f 09 09 09 3d 20 32 | 3b 0d 09 0d 09 7b 31 2e |Go...= 2|;....{1.|
|00001670| 30 31 20 2d 20 6b 44 49 | 54 6f 70 20 61 6e 64 20 |01 - kDI|Top and |
|00001680| 6b 44 49 4c 65 66 74 20 | 61 72 65 20 75 73 65 64 |kDILeft |are used|
|00001690| 20 74 6f 20 6c 6f 63 61 | 74 65 20 74 68 65 20 44 | to loca|te the D|
|000016a0| 69 73 6b 20 49 6e 69 74 | 69 61 6c 69 7a 61 74 69 |isk Init|ializati|
|000016b0| 6f 6e 20 64 69 61 6c 6f | 67 73 2e 7d 0d 09 6b 44 |on dialo|gs.}..kD|
|000016c0| 49 54 6f 70 09 09 3d 20 | 24 30 30 35 30 3b 0d 09 |ITop..= |$0050;..|
|000016d0| 6b 44 49 4c 65 66 74 09 | 09 3d 20 24 30 30 37 30 |kDILeft.|.= $0070|
|000016e0| 3b 0d 0d 0d 56 41 52 0d | 09 7b 54 68 65 20 22 67 |;...VAR.|.{The "g|
|000016f0| 22 20 70 72 65 66 69 78 | 20 69 73 20 75 73 65 64 |" prefix| is used|
|00001700| 20 74 6f 20 65 6d 70 68 | 61 73 69 7a 65 20 74 68 | to emph|asize th|
|00001710| 61 74 20 61 20 76 61 72 | 69 61 62 6c 65 20 69 73 |at a var|iable is|
|00001720| 20 67 6c 6f 62 61 6c 2e | 7d 0d 0d 09 7b 47 4d 61 | global.|}...{GMa|
|00001730| 63 20 69 73 20 75 73 65 | 64 20 74 6f 20 68 6f 6c |c is use|d to hol|
|00001740| 64 20 74 68 65 20 72 65 | 73 75 6c 74 20 6f 66 20 |d the re|sult of |
|00001750| 61 20 53 79 73 45 6e 76 | 69 72 6f 6e 73 20 63 61 |a SysEnv|irons ca|
|00001760| 6c 6c 2e 20 54 68 69 73 | 20 6d 61 6b 65 73 0d 09 |ll. This| makes..|
|00001770| 20 69 74 20 63 6f 6e 76 | 65 6e 69 65 6e 74 20 66 | it conv|enient f|
|00001780| 6f 72 20 61 6e 79 20 72 | 6f 75 74 69 6e 65 20 74 |or any r|outine t|
|00001790| 6f 20 63 68 65 63 6b 20 | 74 68 65 20 65 6e 76 69 |o check |the envi|
|000017a0| 72 6f 6e 6d 65 6e 74 2e | 20 49 74 20 69 73 0d 09 |ronment.| It is..|
|000017b0| 20 67 6c 6f 62 61 6c 20 | 69 6e 66 6f 72 6d 61 74 | global |informat|
|000017c0| 69 6f 6e 2c 20 61 6e 79 | 77 61 79 2e 7d 0d 09 67 |ion, any|way.}..g|
|000017d0| 4d 61 63 09 09 09 09 3a | 20 53 79 73 45 6e 76 52 |Mac....:| SysEnvR|
|000017e0| 65 63 3b 09 7b 73 65 74 | 20 75 70 20 62 79 20 49 |ec;.{set| up by I|
|000017f0| 6e 69 74 69 61 6c 69 7a | 65 7d 0d 0d 09 7b 47 48 |nitializ|e}...{GH|
|00001800| 61 73 57 61 69 74 4e 65 | 78 74 45 76 65 6e 74 20 |asWaitNe|xtEvent |
|00001810| 69 73 20 73 65 74 20 61 | 74 20 73 74 61 72 74 75 |is set a|t startu|
|00001820| 70 2c 20 61 6e 64 20 74 | 65 6c 6c 73 20 77 68 65 |p, and t|ells whe|
|00001830| 74 68 65 72 20 74 68 65 | 20 57 61 69 74 4e 65 78 |ther the| WaitNex|
|00001840| 74 45 76 65 6e 74 0d 09 | 20 74 72 61 70 20 69 73 |tEvent..| trap is|
|00001850| 20 61 76 61 69 6c 61 62 | 6c 65 2e 20 49 66 20 69 | availab|le. If i|
|00001860| 74 20 69 73 20 66 61 6c | 73 65 2c 20 77 65 20 6b |t is fal|se, we k|
|00001870| 6e 6f 77 20 74 68 61 74 | 20 77 65 20 6d 75 73 74 |now that| we must|
|00001880| 20 63 61 6c 6c 20 47 65 | 74 4e 65 78 74 45 76 65 | call Ge|tNextEve|
|00001890| 6e 74 2e 7d 0d 09 67 48 | 61 73 57 61 69 74 4e 65 |nt.}..gH|asWaitNe|
|000018a0| 78 74 45 76 65 6e 74 09 | 3a 20 42 4f 4f 4c 45 41 |xtEvent.|: BOOLEA|
|000018b0| 4e 3b 09 09 7b 73 65 74 | 20 75 70 20 62 79 20 49 |N;..{set| up by I|
|000018c0| 6e 69 74 69 61 6c 69 7a | 65 7d 0d 0d 09 7b 47 49 |nitializ|e}...{GI|
|000018d0| 6e 42 61 63 6b 67 72 6f | 75 6e 64 20 69 73 20 6d |nBackgro|und is m|
|000018e0| 61 69 6e 74 61 69 6e 65 | 64 20 62 79 20 6f 75 72 |aintaine|d by our|
|000018f0| 20 6f 73 45 76 65 6e 74 | 20 68 61 6e 64 6c 69 6e | osEvent| handlin|
|00001900| 67 20 72 6f 75 74 69 6e | 65 73 2e 20 41 6e 79 20 |g routin|es. Any |
|00001910| 70 61 72 74 20 6f 66 0d | 09 20 74 68 65 20 70 72 |part of.|. the pr|
|00001920| 6f 67 72 61 6d 20 63 61 | 6e 20 63 68 65 63 6b 20 |ogram ca|n check |
|00001930| 69 74 20 74 6f 20 66 69 | 6e 64 20 6f 75 74 20 69 |it to fi|nd out i|
|00001940| 66 20 69 74 20 69 73 20 | 63 75 72 72 65 6e 74 6c |f it is |currentl|
|00001950| 79 20 69 6e 20 74 68 65 | 20 62 61 63 6b 67 72 6f |y in the| backgro|
|00001960| 75 6e 64 2e 7d 0d 09 67 | 49 6e 42 61 63 6b 67 72 |und.}..g|InBackgr|
|00001970| 6f 75 6e 64 09 09 3a 20 | 42 4f 4f 4c 45 41 4e 3b |ound..: |BOOLEAN;|
|00001980| 09 09 7b 6d 61 69 6e 74 | 61 69 6e 65 64 20 62 79 |..{maint|ained by|
|00001990| 20 49 6e 69 74 69 61 6c | 69 7a 65 20 61 6e 64 20 | Initial|ize and |
|000019a0| 44 6f 45 76 65 6e 74 7d | 0d 0d 0d 09 7b 54 68 65 |DoEvent}|....{The|
|000019b0| 20 66 6f 6c 6c 6f 77 69 | 6e 67 20 67 6c 6f 62 61 | followi|ng globa|
|000019c0| 6c 73 20 61 72 65 20 74 | 68 65 20 73 74 61 74 65 |ls are t|he state|
|000019d0| 20 6f 66 20 74 68 65 20 | 77 69 6e 64 6f 77 2e 20 | of the |window. |
|000019e0| 49 66 20 77 65 20 73 75 | 70 70 6f 72 74 65 64 20 |If we su|pported |
|000019f0| 6d 6f 72 65 20 74 68 61 | 6e 0d 09 20 6f 6e 65 20 |more tha|n.. one |
|00001a00| 77 69 6e 64 6f 77 2c 20 | 74 68 65 79 20 77 6f 75 |window, |they wou|
|00001a10| 6c 64 20 62 65 20 61 74 | 74 61 74 63 68 65 64 20 |ld be at|tatched |
|00001a20| 74 6f 20 65 61 63 68 20 | 64 6f 63 75 6d 65 6e 74 |to each |document|
|00001a30| 2c 20 72 61 74 68 65 72 | 20 74 68 61 6e 20 67 6c |, rather| than gl|
|00001a40| 6f 62 61 6c 73 2e 7d 0d | 0d 09 7b 47 53 74 6f 70 |obals.}.|..{GStop|
|00001a50| 70 65 64 20 74 65 6c 6c | 73 20 77 68 65 74 68 65 |ped tell|s whethe|
|00001a60| 72 20 74 68 65 20 73 74 | 6f 70 20 6c 69 67 68 74 |r the st|op light|
|00001a70| 20 69 73 20 63 75 72 72 | 65 6e 74 6c 79 20 6f 6e | is curr|ently on|
|00001a80| 20 73 74 6f 70 20 6f 72 | 20 67 6f 2e 7d 0d 09 67 | stop or| go.}..g|
|00001a90| 53 74 6f 70 70 65 64 09 | 09 09 3a 20 42 4f 4f 4c |Stopped.|..: BOOL|
|00001aa0| 45 41 4e 3b 09 09 7b 6d | 61 69 6e 74 61 69 6e 65 |EAN;..{m|aintaine|
|00001ab0| 64 20 62 79 20 49 6e 69 | 74 69 61 6c 69 7a 65 20 |d by Ini|tialize |
|00001ac0| 61 6e 64 20 53 65 74 4c | 69 67 68 74 7d 0d 0d 09 |and SetL|ight}...|
|00001ad0| 7b 47 53 74 6f 70 52 65 | 63 74 20 61 6e 64 20 67 |{GStopRe|ct and g|
|00001ae0| 47 6f 52 65 63 74 20 61 | 72 65 20 74 68 65 20 72 |GoRect a|re the r|
|00001af0| 65 63 74 61 6e 67 6c 65 | 73 20 6f 66 20 74 68 65 |ectangle|s of the|
|00001b00| 20 74 77 6f 20 73 74 6f | 70 20 6c 69 67 68 74 73 | two sto|p lights|
|00001b10| 20 69 6e 20 74 68 65 20 | 77 69 6e 64 6f 77 2e 7d | in the |window.}|
|00001b20| 0d 09 67 53 74 6f 70 52 | 65 63 74 09 09 09 3a 20 |..gStopR|ect...: |
|00001b30| 52 65 63 74 3b 09 09 09 | 7b 73 65 74 20 75 70 20 |Rect;...|{set up |
|00001b40| 62 79 20 49 6e 69 74 69 | 61 6c 69 7a 65 7d 0d 09 |by Initi|alize}..|
|00001b50| 67 47 6f 52 65 63 74 09 | 09 09 09 3a 20 52 65 63 |gGoRect.|...: Rec|
|00001b60| 74 3b 09 09 09 7b 73 65 | 74 20 75 70 20 62 79 20 |t;...{se|t up by |
|00001b70| 49 6e 69 74 69 61 6c 69 | 7a 65 7d 0d 0d 0d 7b 24 |Initiali|ze}...{$|
|00001b80| 53 20 49 6e 69 74 69 61 | 6c 69 7a 65 7d 0d 46 55 |S Initia|lize}.FU|
|00001b90| 4e 43 54 49 4f 4e 20 54 | 72 61 70 41 76 61 69 6c |NCTION T|rapAvail|
|00001ba0| 61 62 6c 65 28 74 4e 75 | 6d 62 65 72 3a 20 49 4e |able(tNu|mber: IN|
|00001bb0| 54 45 47 45 52 3b 20 74 | 54 79 70 65 3a 20 54 72 |TEGER; t|Type: Tr|
|00001bc0| 61 70 54 79 70 65 29 3a | 20 42 4f 4f 4c 45 41 4e |apType):| BOOLEAN|
|00001bd0| 3b 0d 0d 7b 43 68 65 63 | 6b 20 74 6f 20 73 65 65 |;..{Chec|k to see|
|00001be0| 20 69 66 20 61 20 67 69 | 76 65 6e 20 74 72 61 70 | if a gi|ven trap|
|00001bf0| 20 69 73 20 69 6d 70 6c | 65 6d 65 6e 74 65 64 2e | is impl|emented.|
|00001c00| 20 54 68 69 73 20 69 73 | 20 6f 6e 6c 79 20 75 73 | This is| only us|
|00001c10| 65 64 20 62 79 20 74 68 | 65 0d 20 49 6e 69 74 69 |ed by th|e. Initi|
|00001c20| 61 6c 69 7a 65 20 72 6f | 75 74 69 6e 65 20 69 6e |alize ro|utine in|
|00001c30| 20 74 68 69 73 20 70 72 | 6f 67 72 61 6d 2c 20 73 | this pr|ogram, s|
|00001c40| 6f 20 77 65 20 70 75 74 | 20 69 74 20 69 6e 20 74 |o we put| it in t|
|00001c50| 68 65 20 49 6e 69 74 69 | 61 6c 69 7a 65 20 73 65 |he Initi|alize se|
|00001c60| 67 6d 65 6e 74 2e 0d 20 | 54 68 65 20 72 65 63 6f |gment.. |The reco|
|00001c70| 6d 6d 65 6e 64 65 64 20 | 61 70 70 72 6f 61 63 68 |mmended |approach|
|00001c80| 20 74 6f 20 73 65 65 20 | 69 66 20 61 20 74 72 61 | to see |if a tra|
|00001c90| 70 20 69 73 20 69 6d 70 | 6c 65 6d 65 6e 74 65 64 |p is imp|lemented|
|00001ca0| 20 69 73 20 74 6f 20 73 | 65 65 20 69 66 0d 20 74 | is to s|ee if. t|
|00001cb0| 68 65 20 61 64 64 72 65 | 73 73 20 6f 66 20 74 68 |he addre|ss of th|
|00001cc0| 65 20 74 72 61 70 20 72 | 6f 75 74 69 6e 65 20 69 |e trap r|outine i|
|00001cd0| 73 20 74 68 65 20 73 61 | 6d 65 20 61 73 20 74 68 |s the sa|me as th|
|00001ce0| 65 20 61 64 64 72 65 73 | 73 20 6f 66 20 74 68 65 |e addres|s of the|
|00001cf0| 0d 20 55 6e 69 6d 70 6c | 65 6d 65 6e 74 65 64 20 |. Unimpl|emented |
|00001d00| 74 72 61 70 2e 7d 0d 7b | 31 2e 30 32 20 2d 20 4e |trap.}.{|1.02 - N|
|00001d10| 65 65 64 73 20 74 6f 20 | 62 65 20 63 61 6c 6c 65 |eeds to |be calle|
|00001d20| 64 20 61 66 74 65 72 20 | 63 61 6c 6c 20 74 6f 20 |d after |call to |
|00001d30| 53 79 73 45 6e 76 69 72 | 6f 6e 73 20 73 6f 20 74 |SysEnvir|ons so t|
|00001d40| 68 61 74 20 69 74 20 63 | 61 6e 20 63 68 65 63 6b |hat it c|an check|
|00001d50| 0d 20 69 66 20 61 20 54 | 6f 6f 6c 54 72 61 70 20 |. if a T|oolTrap |
|00001d60| 69 73 20 6f 75 74 20 6f | 66 20 72 61 6e 67 65 20 |is out o|f range |
|00001d70| 6f 66 20 61 20 70 72 65 | 2d 4d 61 63 49 49 20 52 |of a pre|-MacII R|
|00001d80| 4f 4d 2e 7d 0d 0d 42 45 | 47 49 4e 0d 09 49 46 20 |OM.}..BE|GIN..IF |
|00001d90| 28 74 54 79 70 65 20 3d | 20 54 6f 6f 6c 54 72 61 |(tType =| ToolTra|
|00001da0| 70 29 20 26 0d 09 09 28 | 67 4d 61 63 2e 6d 61 63 |p) &...(|gMac.mac|
|00001db0| 68 69 6e 65 54 79 70 65 | 20 3e 20 65 6e 76 4d 61 |hineType| > envMa|
|00001dc0| 63 68 55 6e 6b 6e 6f 77 | 6e 29 20 26 0d 09 09 28 |chUnknow|n) &...(|
|00001dd0| 67 4d 61 63 2e 6d 61 63 | 68 69 6e 65 54 79 70 65 |gMac.mac|hineType|
|00001de0| 20 3c 20 65 6e 76 4d 61 | 63 49 49 29 20 54 48 45 | < envMa|cII) THE|
|00001df0| 4e 20 42 45 47 49 4e 09 | 09 7b 69 74 27 73 20 61 |N BEGIN.|.{it's a|
|00001e00| 20 35 31 32 4b 45 2c 20 | 50 6c 75 73 2c 20 6f 72 | 512KE, |Plus, or|
|00001e10| 20 53 45 7d 0d 09 09 74 | 4e 75 6d 62 65 72 20 3a | SE}...t|Number :|
|00001e20| 3d 20 42 41 4e 44 28 74 | 4e 75 6d 62 65 72 2c 20 |= BAND(t|Number, |
|00001e30| 24 30 33 46 46 29 3b 0d | 09 09 49 46 20 74 4e 75 |$03FF);.|..IF tNu|
|00001e40| 6d 62 65 72 20 3e 20 24 | 30 31 46 46 20 54 48 45 |mber > $|01FF THE|
|00001e50| 4e 09 09 09 09 09 09 09 | 7b 77 68 69 63 68 20 6d |N.......|{which m|
|00001e60| 65 61 6e 73 20 74 68 65 | 20 74 6f 6f 6c 20 74 72 |eans the| tool tr|
|00001e70| 61 70 73 7d 0d 09 09 09 | 74 4e 75 6d 62 65 72 20 |aps}....|tNumber |
|00001e80| 3a 3d 20 5f 55 6e 69 6d | 70 6c 65 6d 65 6e 74 65 |:= _Unim|plemente|
|00001e90| 64 3b 09 09 09 09 09 7b | 6f 6e 6c 79 20 67 6f 20 |d;.....{|only go |
|00001ea0| 74 6f 20 24 30 31 46 46 | 7d 0d 09 45 4e 44 3b 0d |to $01FF|}..END;.|
|00001eb0| 09 54 72 61 70 41 76 61 | 69 6c 61 62 6c 65 20 3a |.TrapAva|ilable :|
|00001ec0| 3d 20 4e 47 65 74 54 72 | 61 70 41 64 64 72 65 73 |= NGetTr|apAddres|
|00001ed0| 73 28 74 4e 75 6d 62 65 | 72 2c 20 74 54 79 70 65 |s(tNumbe|r, tType|
|00001ee0| 29 20 3c 3e 0d 09 09 09 | 09 09 09 47 65 74 54 72 |) <>....|...GetTr|
|00001ef0| 61 70 41 64 64 72 65 73 | 73 28 5f 55 6e 69 6d 70 |apAddres|s(_Unimp|
|00001f00| 6c 65 6d 65 6e 74 65 64 | 29 3b 0d 45 4e 44 3b 20 |lemented|);.END; |
|00001f10| 7b 54 72 61 70 41 76 61 | 69 6c 61 62 6c 65 7d 0d |{TrapAva|ilable}.|
|00001f20| 0d 0d 7b 24 53 20 4d 61 | 69 6e 7d 0d 46 55 4e 43 |..{$S Ma|in}.FUNC|
|00001f30| 54 49 4f 4e 20 49 73 44 | 41 57 69 6e 64 6f 77 28 |TION IsD|AWindow(|
|00001f40| 77 69 6e 64 6f 77 3a 20 | 57 69 6e 64 6f 77 50 74 |window: |WindowPt|
|00001f50| 72 29 3a 20 42 4f 4f 4c | 45 41 4e 3b 0d 0d 7b 43 |r): BOOL|EAN;..{C|
|00001f60| 68 65 63 6b 20 69 66 20 | 61 20 77 69 6e 64 6f 77 |heck if |a window|
|00001f70| 20 62 65 6c 6f 6e 67 73 | 20 74 6f 20 61 20 64 65 | belongs| to a de|
|00001f80| 73 6b 20 61 63 63 65 73 | 73 6f 72 79 2e 7d 0d 0d |sk acces|sory.}..|
|00001f90| 42 45 47 49 4e 0d 09 49 | 46 20 77 69 6e 64 6f 77 |BEGIN..I|F window|
|00001fa0| 20 3d 20 4e 49 4c 20 54 | 48 45 4e 0d 09 09 49 73 | = NIL T|HEN...Is|
|00001fb0| 44 41 57 69 6e 64 6f 77 | 20 3a 3d 20 46 41 4c 53 |DAWindow| := FALS|
|00001fc0| 45 0d 09 45 4c 53 45 09 | 7b 44 41 20 77 69 6e 64 |E..ELSE.|{DA wind|
|00001fd0| 6f 77 73 20 68 61 76 65 | 20 6e 65 67 61 74 69 76 |ows have| negativ|
|00001fe0| 65 20 77 69 6e 64 6f 77 | 4b 69 6e 64 73 7d 0d 09 |e window|Kinds}..|
|00001ff0| 09 49 73 44 41 57 69 6e | 64 6f 77 20 3a 3d 20 28 |.IsDAWin|dow := (|
|00002000| 57 69 6e 64 6f 77 50 65 | 65 6b 28 77 69 6e 64 6f |WindowPe|ek(windo|
|00002010| 77 29 5e 2e 77 69 6e 64 | 6f 77 4b 69 6e 64 20 3c |w)^.wind|owKind <|
|00002020| 20 30 29 3b 0d 45 4e 44 | 3b 20 7b 49 73 44 41 57 | 0);.END|; {IsDAW|
|00002030| 69 6e 64 6f 77 7d 0d 0d | 0d 7b 24 53 20 4d 61 69 |indow}..|.{$S Mai|
|00002040| 6e 7d 0d 46 55 4e 43 54 | 49 4f 4e 20 49 73 41 70 |n}.FUNCT|ION IsAp|
|00002050| 70 57 69 6e 64 6f 77 28 | 77 69 6e 64 6f 77 3a 20 |pWindow(|window: |
|00002060| 57 69 6e 64 6f 77 50 74 | 72 29 3a 20 42 4f 4f 4c |WindowPt|r): BOOL|
|00002070| 45 41 4e 3b 0d 0d 7b 43 | 68 65 63 6b 20 74 6f 20 |EAN;..{C|heck to |
|00002080| 73 65 65 20 69 66 20 61 | 20 77 69 6e 64 6f 77 20 |see if a| window |
|00002090| 62 65 6c 6f 6e 67 73 20 | 74 6f 20 74 68 65 20 61 |belongs |to the a|
|000020a0| 70 70 6c 69 63 61 74 69 | 6f 6e 2e 20 49 66 20 74 |pplicati|on. If t|
|000020b0| 68 65 20 77 69 6e 64 6f | 77 20 70 6f 69 6e 74 65 |he windo|w pointe|
|000020c0| 72 0d 20 70 61 73 73 65 | 64 20 77 61 73 20 4e 49 |r. passe|d was NI|
|000020d0| 4c 2c 20 74 68 65 6e 20 | 69 74 20 63 6f 75 6c 64 |L, then |it could|
|000020e0| 20 6e 6f 74 20 62 65 20 | 61 6e 20 61 70 70 6c 69 | not be |an appli|
|000020f0| 63 61 74 69 6f 6e 20 77 | 69 6e 64 6f 77 2e 20 57 |cation w|indow. W|
|00002100| 69 6e 64 6f 77 4b 69 6e | 64 73 0d 20 74 68 61 74 |indowKin|ds. that|
|00002110| 20 61 72 65 20 6e 65 67 | 61 74 69 76 65 20 62 65 | are neg|ative be|
|00002120| 6c 6f 6e 67 20 74 6f 20 | 74 68 65 20 73 79 73 74 |long to |the syst|
|00002130| 65 6d 20 61 6e 64 20 77 | 69 6e 64 6f 77 4b 69 6e |em and w|indowKin|
|00002140| 64 73 20 6c 65 73 73 20 | 74 68 61 6e 20 75 73 65 |ds less |than use|
|00002150| 72 4b 69 6e 64 0d 20 61 | 72 65 20 72 65 73 65 72 |rKind. a|re reser|
|00002160| 76 65 64 20 62 79 20 41 | 70 70 6c 65 20 65 78 63 |ved by A|pple exc|
|00002170| 65 70 74 20 66 6f 72 20 | 77 69 6e 64 6f 77 4b 69 |ept for |windowKi|
|00002180| 6e 64 73 20 65 71 75 61 | 6c 20 74 6f 20 64 69 61 |nds equa|l to dia|
|00002190| 6c 6f 67 4b 69 6e 64 2c | 20 77 68 69 63 68 0d 20 |logKind,| which. |
|000021a0| 6d 65 61 6e 20 69 74 20 | 69 73 20 61 20 64 69 61 |mean it |is a dia|
|000021b0| 6c 6f 67 2e 0d 20 31 2e | 30 32 20 2d 20 49 6e 20 |log.. 1.|02 - In |
|000021c0| 6f 72 64 65 72 20 74 6f | 20 72 65 64 75 63 65 20 |order to| reduce |
|000021d0| 74 68 65 20 63 68 61 6e | 63 65 20 6f 66 20 61 63 |the chan|ce of ac|
|000021e0| 63 69 64 65 6e 74 61 6c | 6c 79 20 74 72 65 61 74 |cidental|ly treat|
|000021f0| 69 6e 67 20 73 6f 6d 65 | 20 77 69 6e 64 6f 77 0d |ing some| window.|
|00002200| 20 61 73 20 61 6e 20 41 | 70 70 57 69 6e 64 6f 77 | as an A|ppWindow|
|00002210| 20 74 68 61 74 20 73 68 | 6f 75 6c 64 6e 27 74 20 | that sh|ouldn't |
|00002220| 62 65 2c 20 77 65 27 6c | 6c 20 6f 6e 6c 79 20 72 |be, we'l|l only r|
|00002230| 65 74 75 72 6e 20 74 72 | 75 65 20 69 66 20 74 68 |eturn tr|ue if th|
|00002240| 65 20 77 69 6e 64 6f 77 | 6b 69 6e 64 0d 20 69 73 |e window|kind. is|
|00002250| 20 75 73 65 72 4b 69 6e | 64 2e 20 49 66 20 79 6f | userKin|d. If yo|
|00002260| 75 20 61 64 64 20 64 69 | 66 66 65 72 65 6e 74 20 |u add di|fferent |
|00002270| 6b 69 6e 64 73 20 6f 66 | 20 77 69 6e 64 6f 77 73 |kinds of| windows|
|00002280| 20 74 6f 20 53 61 6d 70 | 6c 65 20 79 6f 75 27 6c | to Samp|le you'l|
|00002290| 6c 20 6e 65 65 64 0d 20 | 74 6f 20 63 68 61 6e 67 |l need. |to chang|
|000022a0| 65 20 68 6f 77 20 74 68 | 69 73 20 61 6c 6c 20 77 |e how th|is all w|
|000022b0| 6f 72 6b 73 2e 7d 0d 0d | 42 45 47 49 4e 0d 09 49 |orks.}..|BEGIN..I|
|000022c0| 46 20 77 69 6e 64 6f 77 | 20 3d 20 4e 49 4c 20 54 |F window| = NIL T|
|000022d0| 48 45 4e 0d 09 09 49 73 | 41 70 70 57 69 6e 64 6f |HEN...Is|AppWindo|
|000022e0| 77 20 3a 3d 20 46 41 4c | 53 45 0d 09 45 4c 53 45 |w := FAL|SE..ELSE|
|000022f0| 09 7b 61 70 70 6c 69 63 | 61 74 69 6f 6e 20 77 69 |.{applic|ation wi|
|00002300| 6e 64 6f 77 73 20 68 61 | 76 65 20 77 69 6e 64 6f |ndows ha|ve windo|
|00002310| 77 4b 69 6e 64 73 20 3d | 20 75 73 65 72 4b 69 6e |wKinds =| userKin|
|00002320| 64 20 28 38 29 7d 0d 09 | 09 57 49 54 48 20 57 69 |d (8)}..|.WITH Wi|
|00002330| 6e 64 6f 77 50 65 65 6b | 28 77 69 6e 64 6f 77 29 |ndowPeek|(window)|
|00002340| 5e 20 44 4f 0d 09 09 09 | 49 73 41 70 70 57 69 6e |^ DO....|IsAppWin|
|00002350| 64 6f 77 20 3a 3d 20 28 | 77 69 6e 64 6f 77 4b 69 |dow := (|windowKi|
|00002360| 6e 64 20 3d 20 75 73 65 | 72 4b 69 6e 64 29 3b 0d |nd = use|rKind);.|
|00002370| 45 4e 44 3b 20 7b 49 73 | 41 70 70 57 69 6e 64 6f |END; {Is|AppWindo|
|00002380| 77 7d 0d 0d 0d 7b 24 53 | 20 4d 61 69 6e 7d 0d 50 |w}...{$S| Main}.P|
|00002390| 52 4f 43 45 44 55 52 45 | 20 41 6c 65 72 74 55 73 |ROCEDURE| AlertUs|
|000023a0| 65 72 3b 0d 0d 7b 44 69 | 73 70 6c 61 79 20 61 6e |er;..{Di|splay an|
|000023b0| 20 61 6c 65 72 74 20 74 | 68 61 74 20 74 65 6c 6c | alert t|hat tell|
|000023c0| 73 20 74 68 65 20 75 73 | 65 72 20 61 6e 20 65 72 |s the us|er an er|
|000023d0| 72 6f 72 20 6f 63 63 75 | 72 72 65 64 2c 20 74 68 |ror occu|rred, th|
|000023e0| 65 6e 20 65 78 69 74 20 | 74 68 65 20 70 72 6f 67 |en exit |the prog|
|000023f0| 72 61 6d 2e 0d 20 54 68 | 69 73 20 72 6f 75 74 69 |ram.. Th|is routi|
|00002400| 6e 65 20 69 73 20 75 73 | 65 64 20 61 73 20 61 6e |ne is us|ed as an|
|00002410| 20 75 6c 74 69 6d 61 74 | 65 20 62 61 69 6c 2d 6f | ultimat|e bail-o|
|00002420| 75 74 20 66 6f 72 20 73 | 65 72 69 6f 75 73 20 65 |ut for s|erious e|
|00002430| 72 72 6f 72 73 20 74 68 | 61 74 20 70 72 6f 68 69 |rrors th|at prohi|
|00002440| 62 69 74 0d 20 74 68 65 | 20 63 6f 6e 74 69 6e 75 |bit. the| continu|
|00002450| 61 74 69 6f 6e 20 6f 66 | 20 74 68 65 20 61 70 70 |ation of| the app|
|00002460| 6c 69 63 61 74 69 6f 6e | 2e 20 45 72 72 6f 72 73 |lication|. Errors|
|00002470| 20 74 68 61 74 20 64 6f | 20 6e 6f 74 20 72 65 71 | that do| not req|
|00002480| 75 69 72 65 20 74 68 65 | 20 74 65 72 6d 69 6e 61 |uire the| termina|
|00002490| 74 69 6f 6e 0d 20 6f 66 | 20 74 68 65 20 61 70 70 |tion. of| the app|
|000024a0| 6c 69 63 61 74 69 6f 6e | 20 73 68 6f 75 6c 64 20 |lication| should |
|000024b0| 62 65 20 68 61 6e 64 6c | 65 64 20 69 6e 20 61 20 |be handl|ed in a |
|000024c0| 64 69 66 66 65 72 65 6e | 74 20 6d 61 6e 6e 65 72 |differen|t manner|
|000024d0| 2e 20 45 72 72 6f 72 20 | 63 68 65 63 6b 69 6e 67 |. Error |checking|
|000024e0| 20 61 6e 64 0d 20 72 65 | 70 6f 72 74 69 6e 67 20 | and. re|porting |
|000024f0| 68 61 73 20 61 20 70 6c | 61 63 65 20 65 76 65 6e |has a pl|ace even|
|00002500| 20 69 6e 20 74 68 65 20 | 73 69 6d 70 6c 65 73 74 | in the |simplest|
|00002510| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 2e 20 46 6f | applica|tion. Fo|
|00002520| 72 20 73 69 6d 70 6c 69 | 63 69 74 79 2c 20 74 68 |r simpli|city, th|
|00002530| 65 20 61 6c 65 72 74 0d | 20 64 69 73 70 6c 61 79 |e alert.| display|
|00002540| 65 64 20 68 65 72 65 20 | 6f 6e 6c 79 20 73 61 79 |ed here |only say|
|00002550| 73 20 74 68 61 74 20 61 | 6e 20 65 72 72 6f 72 20 |s that a|n error |
|00002560| 6f 63 63 75 72 72 65 64 | 2c 20 62 75 74 20 6e 6f |occurred|, but no|
|00002570| 74 20 77 68 61 74 20 69 | 74 20 77 61 73 2e 20 54 |t what i|t was. T|
|00002580| 68 65 72 65 20 61 72 65 | 0d 20 76 61 72 69 6f 75 |here are|. variou|
|00002590| 73 20 6d 65 74 68 6f 64 | 73 20 61 76 61 69 6c 61 |s method|s availa|
|000025a0| 62 6c 65 20 66 6f 72 20 | 62 65 69 6e 67 20 6d 6f |ble for |being mo|
|000025b0| 72 65 20 73 70 65 63 69 | 66 69 63 2e 7d 0d 20 0d |re speci|fic.}. .|
|000025c0| 56 41 52 0d 09 69 74 65 | 6d 48 69 74 09 3a 20 49 |VAR..ite|mHit.: I|
|000025d0| 4e 54 45 47 45 52 3b 0d | 42 45 47 49 4e 0d 09 53 |NTEGER;.|BEGIN..S|
|000025e0| 65 74 43 75 72 73 6f 72 | 28 61 72 72 6f 77 29 3b |etCursor|(arrow);|
|000025f0| 0d 09 69 74 65 6d 48 69 | 74 20 3a 3d 20 41 6c 65 |..itemHi|t := Ale|
|00002600| 72 74 28 72 55 73 65 72 | 41 6c 65 72 74 2c 20 4e |rt(rUser|Alert, N|
|00002610| 49 4c 29 3b 0d 09 45 78 | 69 74 54 6f 53 68 65 6c |IL);..Ex|itToShel|
|00002620| 6c 3b 0d 45 4e 44 3b 20 | 7b 41 6c 65 72 74 55 73 |l;.END; |{AlertUs|
|00002630| 65 72 7d 0d 0d 0d 7b 24 | 53 20 4d 61 69 6e 7d 0d |er}...{$|S Main}.|
|00002640| 46 55 4e 43 54 49 4f 4e | 20 44 6f 43 6c 6f 73 65 |FUNCTION| DoClose|
|00002650| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 3a 20 57 |Window(w|indow: W|
|00002660| 69 6e 64 6f 77 50 74 72 | 29 20 3a 20 42 4f 4f 4c |indowPtr|) : BOOL|
|00002670| 45 41 4e 3b 0d 0d 7b 43 | 6c 6f 73 65 20 61 20 77 |EAN;..{C|lose a w|
|00002680| 69 6e 64 6f 77 2e 7d 0d | 0d 7b 31 2e 30 31 20 2d |indow.}.|.{1.01 -|
|00002690| 20 41 74 20 74 68 69 73 | 20 70 6f 69 6e 74 2c 20 | At this| point, |
|000026a0| 69 66 20 74 68 65 72 65 | 20 77 61 73 20 61 20 64 |if there| was a d|
|000026b0| 6f 63 75 6d 65 6e 74 20 | 61 73 73 6f 63 69 61 74 |ocument |associat|
|000026c0| 65 64 20 77 69 74 68 20 | 61 0d 20 77 69 6e 64 6f |ed with |a. windo|
|000026d0| 77 2c 20 79 6f 75 20 63 | 6f 75 6c 64 20 64 6f 20 |w, you c|ould do |
|000026e0| 61 6e 79 20 64 6f 63 75 | 6d 65 6e 74 20 73 61 76 |any docu|ment sav|
|000026f0| 69 6e 67 20 70 72 6f 63 | 65 73 73 69 6e 67 20 69 |ing proc|essing i|
|00002700| 66 20 69 74 20 69 73 20 | 27 64 69 72 74 79 27 2e |f it is |'dirty'.|
|00002710| 0d 20 44 6f 43 6c 6f 73 | 65 57 69 6e 64 6f 77 20 |. DoClos|eWindow |
|00002720| 77 6f 75 6c 64 20 72 65 | 74 75 72 6e 20 54 52 55 |would re|turn TRU|
|00002730| 45 20 69 66 20 74 68 65 | 20 77 69 6e 64 6f 77 20 |E if the| window |
|00002740| 61 63 74 75 61 6c 6c 79 | 20 63 6c 6f 73 65 73 2c |actually| closes,|
|00002750| 20 69 2e 65 2e 2c 0d 20 | 74 68 65 20 75 73 65 72 | i.e.,. |the user|
|00002760| 20 64 6f 65 73 20 6e 6f | 74 20 63 61 6e 63 65 6c | does no|t cancel|
|00002770| 20 66 72 6f 6d 20 61 20 | 73 61 76 65 20 64 69 61 | from a |save dia|
|00002780| 6c 6f 67 2e 20 54 68 69 | 73 20 72 65 73 75 6c 74 |log. Thi|s result|
|00002790| 20 69 73 20 68 61 6e 64 | 79 20 77 68 65 6e 0d 20 | is hand|y when. |
|000027a0| 74 68 65 20 75 73 65 72 | 20 71 75 69 74 73 20 61 |the user| quits a|
|000027b0| 6e 20 61 70 70 6c 69 63 | 61 74 69 6f 6e 2c 20 62 |n applic|ation, b|
|000027c0| 75 74 20 74 68 65 6e 20 | 63 61 6e 63 65 6c 73 20 |ut then |cancels |
|000027d0| 61 20 73 61 76 65 20 6f | 66 20 61 20 64 6f 63 75 |a save o|f a docu|
|000027e0| 6d 65 6e 74 0d 20 61 73 | 73 6f 63 69 61 74 65 64 |ment. as|sociated|
|000027f0| 20 77 69 74 68 20 61 20 | 77 69 6e 64 6f 77 2e 20 | with a |window. |
|00002800| 57 65 20 61 6c 73 6f 20 | 61 64 64 65 64 20 63 6f |We also |added co|
|00002810| 64 65 20 74 6f 20 63 6c | 6f 73 65 20 74 68 65 20 |de to cl|ose the |
|00002820| 61 70 70 6c 69 63 61 74 | 69 6f 6e 0d 20 77 69 6e |applicat|ion. win|
|00002830| 64 6f 77 20 73 69 6e 63 | 65 20 6f 74 68 65 72 77 |dow sinc|e otherw|
|00002840| 69 73 65 2c 20 74 68 65 | 20 74 65 72 6d 69 6e 61 |ise, the| termina|
|00002850| 74 69 6f 6e 20 72 6f 75 | 74 69 6e 65 73 20 77 6f |tion rou|tines wo|
|00002860| 75 6c 64 20 6e 65 76 65 | 72 20 73 74 6f 70 20 6c |uld neve|r stop l|
|00002870| 6f 6f 70 69 6e 67 2c 0d | 20 77 61 69 74 69 6e 67 |ooping,.| waiting|
|00002880| 20 66 6f 72 20 46 72 6f | 6e 74 57 69 6e 64 6f 77 | for Fro|ntWindow|
|00002890| 20 74 6f 20 72 65 74 75 | 72 6e 20 4e 49 4c 2e 7d | to retu|rn NIL.}|
|000028a0| 0d 0d 42 45 47 49 4e 0d | 09 44 6f 43 6c 6f 73 65 |..BEGIN.|.DoClose|
|000028b0| 57 69 6e 64 6f 77 20 3a | 3d 20 54 52 55 45 3b 0d |Window :|= TRUE;.|
|000028c0| 09 49 46 20 49 73 44 41 | 57 69 6e 64 6f 77 28 77 |.IF IsDA|Window(w|
|000028d0| 69 6e 64 6f 77 29 20 54 | 48 45 4e 0d 09 09 43 6c |indow) T|HEN...Cl|
|000028e0| 6f 73 65 44 65 73 6b 41 | 63 63 28 57 69 6e 64 6f |oseDeskA|cc(Windo|
|000028f0| 77 50 65 65 6b 28 77 69 | 6e 64 6f 77 29 5e 2e 77 |wPeek(wi|ndow)^.w|
|00002900| 69 6e 64 6f 77 4b 69 6e | 64 29 0d 09 45 4c 53 45 |indowKin|d)..ELSE|
|00002910| 20 49 46 20 49 73 41 70 | 70 57 69 6e 64 6f 77 28 | IF IsAp|pWindow(|
|00002920| 77 69 6e 64 6f 77 29 20 | 54 48 45 4e 0d 09 09 43 |window) |THEN...C|
|00002930| 6c 6f 73 65 57 69 6e 64 | 6f 77 28 77 69 6e 64 6f |loseWind|ow(windo|
|00002940| 77 29 3b 0d 45 4e 44 3b | 20 7b 44 6f 43 6c 6f 73 |w);.END;| {DoClos|
|00002950| 65 57 69 6e 64 6f 77 7d | 0d 0d 0d 7b 24 53 20 49 |eWindow}|...{$S I|
|00002960| 6e 69 74 69 61 6c 69 7a | 65 7d 0d 46 55 4e 43 54 |nitializ|e}.FUNCT|
|00002970| 49 4f 4e 20 47 6f 47 65 | 74 52 65 63 74 28 72 65 |ION GoGe|tRect(re|
|00002980| 63 74 49 44 3a 20 49 4e | 54 45 47 45 52 3b 20 56 |ctID: IN|TEGER; V|
|00002990| 41 52 20 74 68 65 52 65 | 63 74 3a 20 52 65 63 74 |AR theRe|ct: Rect|
|000029a0| 29 20 3a 20 42 4f 4f 4c | 45 41 4e 3b 0d 20 0d 7b |) : BOOL|EAN;. .{|
|000029b0| 54 68 69 73 20 75 74 69 | 6c 69 74 79 20 6c 6f 61 |This uti|lity loa|
|000029c0| 64 73 20 74 68 65 20 67 | 6c 6f 62 61 6c 20 72 65 |ds the g|lobal re|
|000029d0| 63 74 61 6e 67 6c 65 73 | 20 74 68 61 74 20 61 72 |ctangles| that ar|
|000029e0| 65 20 75 73 65 64 20 62 | 79 20 74 68 65 20 77 69 |e used b|y the wi|
|000029f0| 6e 64 6f 77 0d 20 64 72 | 61 77 69 6e 67 20 72 6f |ndow. dr|awing ro|
|00002a00| 75 74 69 6e 65 73 2e 20 | 49 74 20 73 68 6f 77 73 |utines. |It shows|
|00002a10| 20 68 6f 77 20 74 68 65 | 20 72 65 73 6f 75 72 63 | how the| resourc|
|00002a20| 65 20 6d 61 6e 61 67 65 | 72 20 63 61 6e 20 62 65 |e manage|r can be|
|00002a30| 20 75 73 65 64 20 74 6f | 20 68 6f 6c 64 0d 20 76 | used to| hold. v|
|00002a40| 61 6c 75 65 73 20 69 6e | 20 61 20 63 6f 6e 76 65 |alues in| a conve|
|00002a50| 6e 69 65 6e 74 20 6d 61 | 6e 6e 65 72 2e 20 54 68 |nient ma|nner. Th|
|00002a60| 65 73 65 20 76 61 6c 75 | 65 73 20 61 72 65 20 74 |ese valu|es are t|
|00002a70| 68 65 6e 20 65 61 73 69 | 6c 79 20 61 6c 74 65 72 |hen easi|ly alter|
|00002a80| 65 64 20 77 69 74 68 6f | 75 74 0d 20 68 61 76 69 |ed witho|ut. havi|
|00002a90| 6e 67 20 74 6f 20 72 65 | 2d 63 6f 6d 70 69 6c 65 |ng to re|-compile|
|00002aa0| 20 74 68 65 20 73 6f 75 | 72 63 65 20 63 6f 64 65 | the sou|rce code|
|00002ab0| 2e 20 49 6e 20 74 68 69 | 73 20 70 61 72 74 69 63 |. In thi|s partic|
|00002ac0| 75 6c 61 72 20 63 61 73 | 65 2c 20 77 65 20 6b 6e |ular cas|e, we kn|
|00002ad0| 6f 77 0d 20 74 68 61 74 | 20 74 68 69 73 20 72 6f |ow. that| this ro|
|00002ae0| 75 74 69 6e 65 20 69 73 | 20 62 65 69 6e 67 20 63 |utine is| being c|
|00002af0| 61 6c 6c 65 64 20 61 74 | 20 69 6e 69 74 69 61 6c |alled at| initial|
|00002b00| 69 7a 61 74 69 6f 6e 20 | 74 69 6d 65 2e 20 54 68 |ization |time. Th|
|00002b10| 65 72 65 66 6f 72 65 2c | 0d 20 69 66 20 74 68 69 |erefore,|. if thi|
|00002b20| 73 20 72 65 74 75 72 6e | 73 20 46 41 4c 53 45 2c |s return|s FALSE,|
|00002b30| 20 77 65 20 77 69 6c 6c | 20 61 73 73 75 6d 65 20 | we will| assume |
|00002b40| 74 68 61 74 20 74 68 65 | 20 61 70 70 6c 69 63 61 |that the| applica|
|00002b50| 74 69 6f 6e 20 69 73 20 | 69 6e 20 73 75 63 68 0d |tion is |in such.|
|00002b60| 20 62 61 64 20 73 68 61 | 70 65 20 74 68 61 74 20 | bad sha|pe that |
|00002b70| 77 65 20 73 68 6f 75 6c | 64 20 6a 75 73 74 20 65 |we shoul|d just e|
|00002b80| 78 69 74 2e 20 59 6f 75 | 72 20 65 72 72 6f 72 20 |xit. You|r error |
|00002b90| 68 61 6e 64 6c 69 6e 67 | 20 6d 61 79 20 64 69 66 |handling| may dif|
|00002ba0| 66 65 72 2c 20 62 75 74 | 0d 20 74 68 65 20 63 68 |fer, but|. the ch|
|00002bb0| 65 63 6b 20 73 68 6f 75 | 6c 64 20 73 74 69 6c 6c |eck shou|ld still|
|00002bc0| 20 62 65 20 6d 61 64 65 | 2e 7d 0d 0d 7b 31 2e 30 | be made|.}..{1.0|
|00002bd0| 31 20 2d 20 43 68 61 6e | 67 65 64 20 47 6f 47 65 |1 - Chan|ged GoGe|
|00002be0| 74 52 65 63 74 20 74 6f | 20 72 65 74 75 72 6e 20 |tRect to| return |
|00002bf0| 61 20 42 4f 4f 4c 45 41 | 4e 20 74 68 61 74 20 69 |a BOOLEA|N that i|
|00002c00| 6e 64 69 63 61 74 65 73 | 20 69 66 20 69 74 20 77 |ndicates| if it w|
|00002c10| 61 73 20 73 75 63 63 65 | 73 73 66 75 6c 0d 20 69 |as succe|ssful. i|
|00002c20| 6e 20 67 65 74 74 69 6e | 67 20 74 68 65 20 72 65 |n gettin|g the re|
|00002c30| 63 74 61 6e 67 6c 65 20 | 72 61 74 68 65 72 20 74 |ctangle |rather t|
|00002c40| 68 61 6e 20 6a 75 73 74 | 20 64 6f 69 6e 67 20 45 |han just| doing E|
|00002c50| 78 69 74 54 6f 53 68 65 | 6c 6c 2e 7d 0d 20 0d 54 |xitToShe|ll.}. .T|
|00002c60| 59 50 45 0d 09 52 65 63 | 74 50 74 72 09 09 3d 20 |YPE..Rec|tPtr..= |
|00002c70| 5e 52 65 63 74 3b 0d 09 | 52 65 63 74 48 6e 64 09 |^Rect;..|RectHnd.|
|00002c80| 09 3d 20 5e 52 65 63 74 | 50 74 72 3b 0d 56 41 52 |.= ^Rect|Ptr;.VAR|
|00002c90| 0d 09 72 65 73 6f 75 72 | 63 65 09 3a 20 48 61 6e |..resour|ce.: Han|
|00002ca0| 64 6c 65 3b 0d 42 45 47 | 49 4e 0d 09 72 65 73 6f |dle;.BEG|IN..reso|
|00002cb0| 75 72 63 65 20 3a 3d 20 | 47 65 74 52 65 73 6f 75 |urce := |GetResou|
|00002cc0| 72 63 65 28 27 52 45 43 | 54 27 2c 20 72 65 63 74 |rce('REC|T', rect|
|00002cd0| 49 44 29 3b 0d 09 49 46 | 20 72 65 73 6f 75 72 63 |ID);..IF| resourc|
|00002ce0| 65 20 3c 3e 20 4e 49 4c | 20 54 48 45 4e 20 42 45 |e <> NIL| THEN BE|
|00002cf0| 47 49 4e 0d 09 09 47 6f | 47 65 74 52 65 63 74 20 |GIN...Go|GetRect |
|00002d00| 3a 3d 20 54 52 55 45 3b | 0d 09 09 74 68 65 52 65 |:= TRUE;|...theRe|
|00002d10| 63 74 20 3a 3d 20 52 65 | 63 74 48 6e 64 28 72 65 |ct := Re|ctHnd(re|
|00002d20| 73 6f 75 72 63 65 29 5e | 5e 3b 0d 09 09 45 4e 44 |source)^|^;...END|
|00002d30| 0d 09 45 4c 53 45 0d 09 | 09 47 6f 47 65 74 52 65 |..ELSE..|.GoGetRe|
|00002d40| 63 74 20 3a 3d 20 46 41 | 4c 53 45 3b 0d 45 4e 44 |ct := FA|LSE;.END|
|00002d50| 3b 20 7b 47 6f 47 65 74 | 52 65 63 74 7d 0d 0d 0d |; {GoGet|Rect}...|
|00002d60| 7b 24 53 20 49 6e 69 74 | 69 61 6c 69 7a 65 7d 0d |{$S Init|ialize}.|
|00002d70| 50 52 4f 43 45 44 55 52 | 45 20 49 6e 69 74 69 61 |PROCEDUR|E Initia|
|00002d80| 6c 69 7a 65 3b 0d 0d 7b | 53 65 74 20 75 70 20 74 |lize;..{|Set up t|
|00002d90| 68 65 20 77 68 6f 6c 65 | 20 77 6f 72 6c 64 2c 20 |he whole| world, |
|00002da0| 69 6e 63 6c 75 64 69 6e | 67 20 67 6c 6f 62 61 6c |includin|g global|
|00002db0| 20 76 61 72 69 61 62 6c | 65 73 2c 20 54 6f 6f 6c | variabl|es, Tool|
|00002dc0| 62 6f 78 20 6d 61 6e 61 | 67 65 72 73 2c 0d 20 61 |box mana|gers,. a|
|00002dd0| 6e 64 20 6d 65 6e 75 73 | 2e 20 57 65 20 61 6c 73 |nd menus|. We als|
|00002de0| 6f 20 63 72 65 61 74 65 | 20 6f 75 72 20 6f 6e 65 |o create| our one|
|00002df0| 20 61 70 70 6c 69 63 61 | 74 69 6f 6e 20 77 69 6e | applica|tion win|
|00002e00| 64 6f 77 20 61 74 20 74 | 68 69 73 20 74 69 6d 65 |dow at t|his time|
|00002e10| 2e 0d 20 53 69 6e 63 65 | 20 77 69 6e 64 6f 77 20 |.. Since| window |
|00002e20| 73 74 6f 72 61 67 65 20 | 69 73 20 6e 6f 6e 2d 72 |storage |is non-r|
|00002e30| 65 6c 6f 63 61 74 65 61 | 62 6c 65 2c 20 68 6f 77 |elocatea|ble, how|
|00002e40| 20 61 6e 64 20 77 68 65 | 6e 20 74 6f 20 61 6c 6c | and whe|n to all|
|00002e50| 6f 63 61 74 65 20 73 70 | 61 63 65 0d 20 66 6f 72 |ocate sp|ace. for|
|00002e60| 20 77 69 6e 64 6f 77 73 | 20 69 73 20 76 65 72 79 | windows| is very|
|00002e70| 20 69 6d 70 6f 72 74 61 | 6e 74 20 73 6f 20 74 68 | importa|nt so th|
|00002e80| 61 74 20 68 65 61 70 20 | 66 72 61 67 6d 65 6e 74 |at heap |fragment|
|00002e90| 61 74 69 6f 6e 20 64 6f | 65 73 20 6e 6f 74 20 6f |ation do|es not o|
|00002ea0| 63 63 75 72 2e 0d 20 42 | 65 63 61 75 73 65 20 53 |ccur.. B|ecause S|
|00002eb0| 61 6d 70 6c 65 20 68 61 | 73 20 6f 6e 6c 79 20 6f |ample ha|s only o|
|00002ec0| 6e 65 20 77 69 6e 64 6f | 77 20 61 6e 64 20 69 74 |ne windo|w and it|
|00002ed0| 20 69 73 20 6f 6e 6c 79 | 20 64 69 73 70 6f 73 65 | is only| dispose|
|00002ee0| 64 20 77 68 65 6e 20 74 | 68 65 20 61 70 70 6c 69 |d when t|he appli|
|00002ef0| 63 61 74 69 6f 6e 0d 20 | 71 75 69 74 73 2c 20 77 |cation. |quits, w|
|00002f00| 65 20 77 69 6c 6c 20 61 | 6c 6c 6f 63 61 74 65 20 |e will a|llocate |
|00002f10| 69 74 73 20 73 70 61 63 | 65 20 68 65 72 65 2c 20 |its spac|e here, |
|00002f20| 62 65 66 6f 72 65 20 61 | 6e 79 74 68 69 6e 67 20 |before a|nything |
|00002f30| 74 68 61 74 20 6d 69 67 | 68 74 20 62 65 20 61 20 |that mig|ht be a |
|00002f40| 6c 6f 63 6b 65 64 0d 20 | 72 65 6c 6f 63 61 74 61 |locked. |relocata|
|00002f50| 62 6c 65 20 6f 62 6a 65 | 63 74 20 67 65 74 73 20 |ble obje|ct gets |
|00002f60| 69 6e 74 6f 20 74 68 65 | 20 68 65 61 70 2e 20 54 |into the| heap. T|
|00002f70| 68 69 73 20 77 61 79 2c | 20 77 65 20 63 61 6e 20 |his way,| we can |
|00002f80| 66 6f 72 63 65 20 69 74 | 73 20 73 74 6f 72 61 67 |force it|s storag|
|00002f90| 65 20 74 6f 20 62 65 0d | 20 69 6e 20 74 68 65 20 |e to be.| in the |
|00002fa0| 6c 6f 77 65 73 74 20 6d | 65 6d 6f 72 79 20 61 76 |lowest m|emory av|
|00002fb0| 61 69 6c 61 62 6c 65 20 | 69 6e 20 74 68 65 20 68 |ailable |in the h|
|00002fc0| 65 61 70 2e 20 57 69 6e | 64 6f 77 20 73 74 6f 72 |eap. Win|dow stor|
|00002fd0| 61 67 65 20 63 61 6e 20 | 64 69 66 66 65 72 20 77 |age can |differ w|
|00002fe0| 69 64 65 6c 79 0d 20 61 | 6d 6f 6e 67 73 74 20 61 |idely. a|mongst a|
|00002ff0| 70 70 6c 69 63 61 74 69 | 6f 6e 73 20 64 65 70 65 |pplicati|ons depe|
|00003000| 6e 64 69 6e 67 20 6f 6e | 20 68 6f 77 20 6d 61 6e |nding on| how man|
|00003010| 79 20 77 69 6e 64 6f 77 | 73 20 61 72 65 20 63 72 |y window|s are cr|
|00003020| 65 61 74 65 64 20 61 6e | 64 20 64 69 73 70 6f 73 |eated an|d dispos|
|00003030| 65 64 2e 0d 20 49 66 20 | 61 20 66 61 69 6c 75 72 |ed.. If |a failur|
|00003040| 65 20 6f 63 63 75 72 73 | 20 68 65 72 65 2c 20 77 |e occurs| here, w|
|00003050| 65 20 77 69 6c 6c 20 63 | 6f 6e 73 69 64 65 72 20 |e will c|onsider |
|00003060| 74 68 61 74 20 74 68 65 | 20 61 70 70 6c 69 63 61 |that the| applica|
|00003070| 74 69 6f 6e 20 69 73 20 | 69 6e 20 73 75 63 68 0d |tion is |in such.|
|00003080| 20 62 61 64 20 73 68 61 | 70 65 20 74 68 61 74 20 | bad sha|pe that |
|00003090| 77 65 20 73 68 6f 75 6c | 64 20 6a 75 73 74 20 65 |we shoul|d just e|
|000030a0| 78 69 74 2e 20 59 6f 75 | 72 20 65 72 72 6f 72 20 |xit. You|r error |
|000030b0| 68 61 6e 64 6c 69 6e 67 | 20 6d 61 79 20 64 69 66 |handling| may dif|
|000030c0| 66 65 72 2c 20 62 75 74 | 0d 20 74 68 65 20 63 68 |fer, but|. the ch|
|000030d0| 65 63 6b 73 20 73 68 6f | 75 6c 64 20 73 74 69 6c |ecks sho|uld stil|
|000030e0| 6c 20 62 65 20 6d 61 64 | 65 2e 7d 0d 20 0d 7b 31 |l be mad|e.}. .{1|
|000030f0| 2e 30 31 20 2d 20 54 68 | 65 20 63 6f 64 65 20 74 |.01 - Th|e code t|
|00003100| 68 61 74 20 75 73 65 64 | 20 74 6f 20 62 65 20 70 |hat used| to be p|
|00003110| 61 72 74 20 6f 66 20 46 | 6f 72 63 65 45 6e 76 69 |art of F|orceEnvi|
|00003120| 72 6f 6e 73 20 68 61 73 | 20 62 65 65 6e 20 6d 6f |rons has| been mo|
|00003130| 76 65 64 20 69 6e 74 6f | 0d 20 74 68 69 73 20 6d |ved into|. this m|
|00003140| 6f 64 75 6c 65 2e 20 49 | 66 20 61 6e 20 65 72 72 |odule. I|f an err|
|00003150| 6f 72 20 69 73 20 64 65 | 74 65 63 74 65 64 2c 20 |or is de|tected, |
|00003160| 69 6e 73 74 65 61 64 20 | 6f 66 20 6d 65 72 65 6c |instead |of merel|
|00003170| 79 20 64 6f 69 6e 67 20 | 61 6e 20 45 78 69 74 54 |y doing |an ExitT|
|00003180| 6f 53 68 65 6c 6c 2c 0d | 20 77 68 69 63 68 20 6c |oShell,.| which l|
|00003190| 65 61 76 65 73 20 74 68 | 65 20 75 73 65 72 20 77 |eaves th|e user w|
|000031a0| 69 74 68 6f 75 74 20 6d | 75 63 68 20 74 6f 20 67 |ithout m|uch to g|
|000031b0| 6f 20 6f 6e 2c 20 77 65 | 20 63 61 6c 6c 20 41 6c |o on, we| call Al|
|000031c0| 65 72 74 55 73 65 72 2c | 20 77 68 69 63 68 20 70 |ertUser,| which p|
|000031d0| 75 74 73 0d 20 75 70 20 | 61 20 73 69 6d 70 6c 65 |uts. up |a simple|
|000031e0| 20 61 6c 65 72 74 20 74 | 68 61 74 20 6a 75 73 74 | alert t|hat just|
|000031f0| 20 73 61 79 73 20 61 6e | 20 65 72 72 6f 72 20 6f | says an| error o|
|00003200| 63 63 75 72 72 65 64 20 | 61 6e 64 20 74 68 65 6e |ccurred |and then|
|00003210| 20 63 61 6c 6c 73 20 45 | 78 69 74 54 6f 53 68 65 | calls E|xitToShe|
|00003220| 6c 6c 2e 0d 20 49 6e 20 | 74 68 65 20 69 6e 74 65 |ll.. In |the inte|
|00003230| 72 65 73 74 73 20 6f 66 | 20 6b 65 65 70 69 6e 67 |rests of| keeping|
|00003240| 20 74 68 69 6e 67 73 20 | 73 69 6d 70 6c 65 2c 20 | things |simple, |
|00003250| 74 68 65 20 61 6c 65 72 | 74 20 64 6f 65 73 20 6e |the aler|t does n|
|00003260| 6f 74 20 73 74 61 74 65 | 20 74 68 65 20 73 70 65 |ot state| the spe|
|00003270| 63 69 66 69 63 0d 20 63 | 61 75 73 65 20 6f 66 20 |cific. c|ause of |
|00003280| 74 68 65 20 65 72 72 6f | 72 2c 20 62 75 74 20 61 |the erro|r, but a|
|00003290| 20 6d 6f 72 65 20 69 6e | 66 6f 72 6d 61 74 69 76 | more in|formativ|
|000032a0| 65 20 61 6c 65 72 74 20 | 77 6f 75 6c 64 20 62 65 |e alert |would be|
|000032b0| 20 61 70 70 72 6f 70 72 | 69 61 74 65 20 66 6f 72 | appropr|iate for|
|000032c0| 20 6d 6f 72 65 0d 20 73 | 6f 70 68 69 73 74 69 63 | more. s|ophistic|
|000032d0| 61 74 65 64 20 61 70 70 | 6c 69 63 61 74 69 6f 6e |ated app|lication|
|000032e0| 73 2e 20 53 69 6e 63 65 | 20 74 68 65 72 65 20 69 |s. Since| there i|
|000032f0| 73 20 6e 6f 20 6f 74 68 | 65 72 20 63 6c 65 61 6e |s no oth|er clean|
|00003300| 75 70 20 6e 65 65 64 65 | 64 20 61 74 20 74 68 69 |up neede|d at thi|
|00003310| 73 20 70 6f 69 6e 74 0d | 20 69 66 20 61 6e 20 65 |s point.| if an e|
|00003320| 72 72 6f 72 20 69 73 20 | 64 65 74 65 63 74 65 64 |rror is |detected|
|00003330| 2c 20 74 68 69 73 20 66 | 6f 72 6d 20 6f 66 20 65 |, this f|orm of e|
|00003340| 72 72 6f 72 2d 20 68 61 | 6e 64 6c 69 6e 67 20 69 |rror- ha|ndling i|
|00003350| 73 20 61 63 63 65 70 74 | 61 62 6c 65 2e 20 49 66 |s accept|able. If|
|00003360| 20 6d 6f 72 65 0d 20 73 | 6f 70 68 69 73 74 69 63 | more. s|ophistic|
|00003370| 61 74 65 64 20 65 72 72 | 6f 72 20 72 65 63 6f 76 |ated err|or recov|
|00003380| 65 72 79 20 69 73 20 6e | 65 65 64 65 64 2c 20 61 |ery is n|eeded, a|
|00003390| 20 73 69 67 6e 61 6c 20 | 6d 65 63 68 61 6e 69 73 | signal |mechanis|
|000033a0| 6d 2c 20 73 75 63 68 20 | 61 73 20 69 73 20 70 72 |m, such |as is pr|
|000033b0| 6f 76 69 64 65 64 0d 20 | 62 79 20 53 69 67 6e 61 |ovided. |by Signa|
|000033c0| 6c 73 2c 20 63 61 6e 20 | 62 65 20 75 73 65 64 2e |ls, can |be used.|
|000033d0| 7d 0d 0d 56 41 52 0d 09 | 6d 65 6e 75 42 61 72 09 |}..VAR..|menuBar.|
|000033e0| 09 09 3a 20 48 61 6e 64 | 6c 65 3b 0d 09 77 69 6e |..: Hand|le;..win|
|000033f0| 64 6f 77 09 09 09 3a 20 | 57 69 6e 64 6f 77 50 74 |dow...: |WindowPt|
|00003400| 72 3b 0d 09 69 67 6e 6f | 72 65 45 72 72 6f 72 09 |r;..igno|reError.|
|00003410| 09 3a 20 4f 53 45 72 72 | 3b 0d 09 74 6f 74 61 6c |.: OSErr|;..total|
|00003420| 2c 20 63 6f 6e 74 69 67 | 09 3a 20 4c 6f 6e 67 49 |, contig|.: LongI|
|00003430| 6e 74 3b 0d 09 69 67 6e | 6f 72 65 52 65 73 75 6c |nt;..ign|oreResul|
|00003440| 74 09 3a 20 42 4f 4f 4c | 45 41 4e 3b 0d 09 65 76 |t.: BOOL|EAN;..ev|
|00003450| 65 6e 74 09 09 09 3a 20 | 45 76 65 6e 74 52 65 63 |ent...: |EventRec|
|00003460| 6f 72 64 3b 0d 09 63 6f | 75 6e 74 09 09 09 3a 20 |ord;..co|unt...: |
|00003470| 49 4e 54 45 47 45 52 3b | 0d 0d 42 45 47 49 4e 0d |INTEGER;|..BEGIN.|
|00003480| 09 67 49 6e 42 61 63 6b | 67 72 6f 75 6e 64 20 3a |.gInBack|ground :|
|00003490| 3d 20 46 41 4c 53 45 3b | 0d 0d 09 49 6e 69 74 47 |= FALSE;|...InitG|
|000034a0| 72 61 66 28 40 74 68 65 | 50 6f 72 74 29 3b 0d 09 |raf(@the|Port);..|
|000034b0| 49 6e 69 74 46 6f 6e 74 | 73 3b 0d 09 49 6e 69 74 |InitFont|s;..Init|
|000034c0| 57 69 6e 64 6f 77 73 3b | 0d 09 49 6e 69 74 4d 65 |Windows;|..InitMe|
|000034d0| 6e 75 73 3b 0d 09 54 45 | 49 6e 69 74 3b 0d 09 49 |nus;..TE|Init;..I|
|000034e0| 6e 69 74 44 69 61 6c 6f | 67 73 28 4e 49 4c 29 3b |nitDialo|gs(NIL);|
|000034f0| 0d 09 49 6e 69 74 43 75 | 72 73 6f 72 3b 0d 09 0d |..InitCu|rsor;...|
|00003500| 09 7b 43 61 6c 6c 20 4d | 50 50 4f 70 65 6e 20 61 |.{Call M|PPOpen a|
|00003510| 6e 64 20 41 54 50 4c 6f | 61 64 20 61 74 20 74 68 |nd ATPLo|ad at th|
|00003520| 69 73 20 70 6f 69 6e 74 | 20 74 6f 20 69 6e 69 74 |is point| to init|
|00003530| 69 61 6c 69 7a 65 20 41 | 70 70 6c 65 54 61 6c 6b |ialize A|ppleTalk|
|00003540| 2c 0d 09 20 69 66 20 79 | 6f 75 20 61 72 65 20 75 |,.. if y|ou are u|
|00003550| 73 69 6e 67 20 69 74 2e | 7d 0d 09 7b 4e 4f 54 45 |sing it.|}..{NOTE|
|00003560| 20 2d 2d 20 49 74 20 69 | 73 20 6e 6f 20 6c 6f 6e | -- It i|s no lon|
|00003570| 67 65 72 20 6e 65 63 65 | 73 73 61 72 79 2c 20 61 |ger nece|ssary, a|
|00003580| 6e 64 20 61 63 74 75 61 | 6c 6c 79 20 75 6e 68 65 |nd actua|lly unhe|
|00003590| 61 6c 74 68 79 2c 20 74 | 6f 20 63 68 65 63 6b 0d |althy, t|o check.|
|000035a0| 09 20 50 6f 72 74 42 55 | 73 65 20 61 6e 64 20 53 |. PortBU|se and S|
|000035b0| 50 43 6f 6e 66 69 67 20 | 62 65 66 6f 72 65 20 6f |PConfig |before o|
|000035c0| 70 65 6e 69 6e 67 20 41 | 70 70 6c 65 54 61 6c 6b |pening A|ppleTalk|
|000035d0| 2e 20 54 68 65 20 64 72 | 69 76 65 72 73 20 61 72 |. The dr|ivers ar|
|000035e0| 65 20 63 61 70 61 62 6c | 65 0d 09 20 6f 66 20 63 |e capabl|e.. of c|
|000035f0| 68 65 63 6b 69 6e 67 20 | 66 6f 72 20 70 6f 72 74 |hecking |for port|
|00003600| 20 61 76 61 69 6c 61 62 | 69 6c 69 74 79 20 74 68 | availab|ility th|
|00003610| 65 6d 73 65 6c 76 65 73 | 2e 7d 0d 09 0d 09 7b 54 |emselves|.}....{T|
|00003620| 68 69 73 20 6e 65 78 74 | 20 62 69 74 20 6f 66 20 |his next| bit of |
|00003630| 63 6f 64 65 20 69 73 20 | 6e 65 63 65 73 73 61 72 |code is |necessar|
|00003640| 79 20 74 6f 20 61 6c 6c | 6f 77 20 74 68 65 20 64 |y to all|ow the d|
|00003650| 65 66 61 75 6c 74 20 62 | 75 74 74 6f 6e 20 6f 66 |efault b|utton of|
|00003660| 20 6f 75 72 0d 09 20 61 | 6c 65 72 74 20 62 65 20 | our.. a|lert be |
|00003670| 6f 75 74 6c 69 6e 65 64 | 2e 0d 09 20 31 2e 30 32 |outlined|... 1.02|
|00003680| 20 2d 20 43 68 61 6e 67 | 65 64 20 74 6f 20 63 61 | - Chang|ed to ca|
|00003690| 6c 6c 20 45 76 65 6e 74 | 41 76 61 69 6c 20 73 6f |ll Event|Avail so|
|000036a0| 20 74 68 61 74 20 77 65 | 20 64 6f 6e 27 74 20 6c | that we| don't l|
|000036b0| 6f 73 65 20 73 6f 6d 65 | 20 69 6d 70 6f 72 74 61 |ose some| importa|
|000036c0| 6e 74 0d 09 20 65 76 65 | 6e 74 73 2e 7d 0d 09 20 |nt.. eve|nts.}.. |
|000036d0| 0d 09 46 4f 52 20 63 6f | 75 6e 74 20 3a 3d 20 31 |..FOR co|unt := 1|
|000036e0| 20 54 4f 20 33 20 44 4f | 0d 09 09 69 67 6e 6f 72 | TO 3 DO|...ignor|
|000036f0| 65 52 65 73 75 6c 74 20 | 3a 3d 20 45 76 65 6e 74 |eResult |:= Event|
|00003700| 41 76 61 69 6c 28 65 76 | 65 72 79 45 76 65 6e 74 |Avail(ev|eryEvent|
|00003710| 2c 20 65 76 65 6e 74 29 | 3b 0d 09 0d 09 7b 49 67 |, event)|;....{Ig|
|00003720| 6e 6f 72 65 20 74 68 65 | 20 65 72 72 6f 72 20 72 |nore the| error r|
|00003730| 65 74 75 72 6e 65 64 20 | 66 72 6f 6d 20 53 79 73 |eturned |from Sys|
|00003740| 45 6e 76 69 72 6f 6e 73 | 3b 20 65 76 65 6e 20 69 |Environs|; even i|
|00003750| 66 20 61 6e 20 65 72 72 | 6f 72 20 6f 63 63 75 72 |f an err|or occur|
|00003760| 72 65 64 2c 0d 09 20 74 | 68 65 20 53 79 73 45 6e |red,.. t|he SysEn|
|00003770| 76 69 72 6f 6e 73 20 67 | 6c 75 65 20 77 69 6c 6c |virons g|lue will|
|00003780| 20 66 69 6c 6c 20 69 6e | 20 74 68 65 20 53 79 73 | fill in| the Sys|
|00003790| 45 6e 76 52 65 63 2e 20 | 59 6f 75 20 63 61 6e 20 |EnvRec. |You can |
|000037a0| 73 61 76 65 20 61 20 72 | 65 64 75 6e 64 61 6e 74 |save a r|edundant|
|000037b0| 0d 09 20 63 61 6c 6c 20 | 74 6f 20 53 79 73 45 6e |.. call |to SysEn|
|000037c0| 76 69 72 6f 6e 73 20 62 | 79 20 63 61 6c 6c 69 6e |virons b|y callin|
|000037d0| 67 20 69 74 20 61 66 74 | 65 72 20 69 6e 69 74 69 |g it aft|er initi|
|000037e0| 61 6c 69 7a 69 6e 67 20 | 41 70 70 6c 65 54 61 6c |alizing |AppleTal|
|000037f0| 6b 2e 7d 0d 09 20 0d 09 | 69 67 6e 6f 72 65 45 72 |k.}.. ..|ignoreEr|
|00003800| 72 6f 72 20 3a 3d 20 53 | 79 73 45 6e 76 69 72 6f |ror := S|ysEnviro|
|00003810| 6e 73 28 6b 53 79 73 45 | 6e 76 69 72 6f 6e 73 56 |ns(kSysE|nvironsV|
|00003820| 65 72 73 69 6f 6e 2c 20 | 67 4d 61 63 29 3b 0d 09 |ersion, |gMac);..|
|00003830| 0d 09 7b 4d 61 6b 65 20 | 73 75 72 65 20 74 68 61 |..{Make |sure tha|
|00003840| 74 20 74 68 65 20 6d 61 | 63 68 69 6e 65 20 68 61 |t the ma|chine ha|
|00003850| 73 20 61 74 20 6c 65 61 | 73 74 20 31 32 38 4b 20 |s at lea|st 128K |
|00003860| 52 4f 4d 73 2e 20 49 66 | 20 69 74 20 64 6f 65 73 |ROMs. If| it does|
|00003870| 6e 27 74 2c 20 65 78 69 | 74 2e 7d 0d 09 0d 09 49 |n't, exi|t.}....I|
|00003880| 46 20 67 4d 61 63 2e 6d | 61 63 68 69 6e 65 54 79 |F gMac.m|achineTy|
|00003890| 70 65 20 3c 20 30 20 54 | 48 45 4e 20 41 6c 65 72 |pe < 0 T|HEN Aler|
|000038a0| 74 55 73 65 72 3b 0d 09 | 0d 09 7b 31 2e 30 32 20 |tUser;..|..{1.02 |
|000038b0| 2d 20 4d 6f 76 65 20 54 | 72 61 70 41 76 61 69 6c |- Move T|rapAvail|
|000038c0| 61 62 6c 65 20 63 61 6c | 6c 20 74 6f 20 61 66 74 |able cal|l to aft|
|000038d0| 65 72 20 53 79 73 45 6e | 76 69 72 6f 6e 73 20 73 |er SysEn|virons s|
|000038e0| 6f 20 74 68 61 74 20 77 | 65 20 63 61 6e 20 74 65 |o that w|e can te|
|000038f0| 6c 6c 0d 09 20 69 6e 20 | 54 72 61 70 41 76 61 69 |ll.. in |TrapAvai|
|00003900| 6c 61 62 6c 65 20 69 66 | 20 61 20 74 6f 6f 6c 20 |lable if| a tool |
|00003910| 74 72 61 70 20 76 61 6c | 75 65 20 69 73 20 6f 75 |trap val|ue is ou|
|00003920| 74 20 6f 66 20 72 61 6e | 67 65 2e 7d 0d 09 20 0d |t of ran|ge.}.. .|
|00003930| 09 67 48 61 73 57 61 69 | 74 4e 65 78 74 45 76 65 |.gHasWai|tNextEve|
|00003940| 6e 74 20 3a 3d 20 54 72 | 61 70 41 76 61 69 6c 61 |nt := Tr|apAvaila|
|00003950| 62 6c 65 28 5f 57 61 69 | 74 4e 65 78 74 45 76 65 |ble(_Wai|tNextEve|
|00003960| 6e 74 2c 20 54 6f 6f 6c | 54 72 61 70 29 3b 0d 0d |nt, Tool|Trap);..|
|00003970| 09 7b 31 2e 30 31 20 2d | 20 57 65 20 75 73 65 64 |.{1.01 -| We used|
|00003980| 20 74 6f 20 6d 61 6b 65 | 20 61 20 63 68 65 63 6b | to make| a check|
|00003990| 20 66 6f 72 20 6d 65 6d | 6f 72 79 20 61 74 20 74 | for mem|ory at t|
|000039a0| 68 69 73 20 70 6f 69 6e | 74 20 62 79 20 65 78 61 |his poin|t by exa|
|000039b0| 6d 69 6e 69 6e 67 20 41 | 70 70 6c 4c 69 6d 69 74 |mining A|pplLimit|
|000039c0| 2c 0d 09 20 41 70 70 6c | 69 63 5a 6f 6e 65 2c 20 |,.. Appl|icZone, |
|000039d0| 61 6e 64 20 53 74 61 63 | 6b 53 70 61 63 65 20 61 |and Stac|kSpace a|
|000039e0| 6e 64 20 63 6f 6d 70 61 | 72 69 6e 67 20 74 68 61 |nd compa|ring tha|
|000039f0| 74 20 74 6f 20 74 68 65 | 20 6d 69 6e 69 6d 75 6d |t to the| minimum|
|00003a00| 20 73 69 7a 65 20 77 65 | 20 74 6f 6c 64 0d 09 20 | size we| told.. |
|00003a10| 4d 75 6c 74 69 46 69 6e | 64 65 72 20 77 65 20 6e |MultiFin|der we n|
|00003a20| 65 65 64 65 64 2e 20 54 | 68 69 73 20 64 69 64 20 |eeded. T|his did |
|00003a30| 6e 6f 74 20 77 6f 72 6b | 20 77 65 6c 6c 20 62 65 |not work| well be|
|00003a40| 63 61 75 73 65 20 69 74 | 20 61 73 73 75 6d 65 64 |cause it| assumed|
|00003a50| 20 74 6f 6f 20 6d 75 63 | 68 20 61 62 6f 75 74 0d | too muc|h about.|
|00003a60| 09 20 74 68 65 20 72 65 | 6c 61 74 69 6f 6e 73 68 |. the re|lationsh|
|00003a70| 69 70 20 62 65 74 77 65 | 65 6e 20 77 68 61 74 20 |ip betwe|en what |
|00003a80| 77 65 20 61 73 6b 65 64 | 20 4d 75 6c 74 69 46 69 |we asked| MultiFi|
|00003a90| 6e 64 65 72 20 66 6f 72 | 20 61 6e 64 20 77 68 61 |nder for| and wha|
|00003aa0| 74 20 77 65 20 77 6f 75 | 6c 64 20 61 63 74 75 61 |t we wou|ld actua|
|00003ab0| 6c 6c 79 0d 09 20 67 65 | 74 20 62 61 63 6b 2c 20 |lly.. ge|t back, |
|00003ac0| 61 73 20 77 65 6c 6c 20 | 61 73 20 68 6f 77 20 74 |as well |as how t|
|00003ad0| 6f 20 6d 65 61 73 75 72 | 65 20 69 74 2e 20 49 6e |o measur|e it. In|
|00003ae0| 73 74 65 61 64 2c 20 77 | 65 20 77 69 6c 6c 20 75 |stead, w|e will u|
|00003af0| 73 65 20 61 6e 20 61 6c | 74 65 72 6e 61 74 65 0d |se an al|ternate.|
|00003b00| 09 20 6d 65 74 68 6f 64 | 20 63 6f 6d 70 72 69 73 |. method| compris|
|00003b10| 65 64 20 6f 66 20 74 77 | 6f 20 73 74 65 70 73 2e |ed of tw|o steps.|
|00003b20| 7d 0d 09 20 0d 09 7b 49 | 74 20 69 73 20 62 65 74 |}.. ..{I|t is bet|
|00003b30| 74 65 72 20 74 6f 20 66 | 69 72 73 74 20 63 68 65 |ter to f|irst che|
|00003b40| 63 6b 20 74 68 65 20 73 | 69 7a 65 20 6f 66 20 74 |ck the s|ize of t|
|00003b50| 68 65 20 61 70 70 6c 69 | 63 61 74 69 6f 6e 20 68 |he appli|cation h|
|00003b60| 65 61 70 20 61 67 61 69 | 6e 73 74 20 61 20 76 61 |eap agai|nst a va|
|00003b70| 6c 75 65 0d 09 20 74 68 | 61 74 20 79 6f 75 20 68 |lue.. th|at you h|
|00003b80| 61 76 65 20 64 65 74 65 | 72 6d 69 6e 65 64 20 69 |ave dete|rmined i|
|00003b90| 73 20 74 68 65 20 73 6d | 61 6c 6c 65 73 74 20 68 |s the sm|allest h|
|00003ba0| 65 61 70 20 74 68 65 20 | 61 70 70 6c 69 63 61 74 |eap the |applicat|
|00003bb0| 69 6f 6e 20 63 61 6e 20 | 72 65 61 73 6f 6e 61 62 |ion can |reasonab|
|00003bc0| 6c 79 0d 09 20 77 6f 72 | 6b 20 69 6e 2e 20 54 68 |ly.. wor|k in. Th|
|00003bd0| 69 73 20 6e 75 6d 62 65 | 72 20 73 68 6f 75 6c 64 |is numbe|r should|
|00003be0| 20 62 65 20 64 65 72 69 | 76 65 64 20 62 79 20 65 | be deri|ved by e|
|00003bf0| 78 61 6d 69 6e 69 6e 67 | 20 74 68 65 20 73 69 7a |xamining| the siz|
|00003c00| 65 20 6f 66 20 74 68 65 | 20 68 65 61 70 20 74 68 |e of the| heap th|
|00003c10| 61 74 0d 09 20 69 73 20 | 61 63 74 75 61 6c 6c 79 |at.. is |actually|
|00003c20| 20 70 72 6f 76 69 64 65 | 64 20 62 79 20 4d 75 6c | provide|d by Mul|
|00003c30| 74 69 46 69 6e 64 65 72 | 20 77 68 65 6e 20 74 68 |tiFinder| when th|
|00003c40| 65 20 6d 69 6e 69 6d 75 | 6d 20 73 69 7a 65 20 72 |e minimu|m size r|
|00003c50| 65 71 75 65 73 74 65 64 | 20 69 73 20 75 73 65 64 |equested| is used|
|00003c60| 2e 0d 09 20 54 68 65 20 | 64 65 72 69 76 61 74 69 |... The |derivati|
|00003c70| 6f 6e 20 6f 66 20 74 68 | 65 20 6d 69 6e 69 6d 75 |on of th|e minimu|
|00003c80| 6d 20 73 69 7a 65 20 72 | 65 71 75 65 73 74 65 64 |m size r|equested|
|00003c90| 20 66 72 6f 6d 20 4d 75 | 6c 74 69 46 69 6e 64 65 | from Mu|ltiFinde|
|00003ca0| 72 20 69 73 20 64 65 73 | 63 72 69 62 65 64 0d 09 |r is des|cribed..|
|00003cb0| 20 69 6e 20 53 61 6d 70 | 6c 65 2e 68 2e 20 54 68 | in Samp|le.h. Th|
|00003cc0| 65 20 63 68 65 63 6b 20 | 73 68 6f 75 6c 64 20 62 |e check |should b|
|00003cd0| 65 20 6d 61 64 65 20 62 | 65 63 61 75 73 65 20 74 |e made b|ecause t|
|00003ce0| 68 65 20 70 72 65 66 65 | 72 72 65 64 20 73 69 7a |he prefe|rred siz|
|00003cf0| 65 20 63 61 6e 20 65 6e | 64 20 75 70 0d 09 20 62 |e can en|d up.. b|
|00003d00| 65 69 6e 67 20 73 65 74 | 20 73 6d 61 6c 6c 65 72 |eing set| smaller|
|00003d10| 20 74 68 61 6e 20 74 68 | 65 20 6d 69 6e 69 6d 75 | than th|e minimu|
|00003d20| 6d 20 73 69 7a 65 20 62 | 79 20 74 68 65 20 75 73 |m size b|y the us|
|00003d30| 65 72 2e 20 54 68 69 73 | 20 65 78 74 72 61 20 63 |er. This| extra c|
|00003d40| 68 65 63 6b 20 61 63 74 | 73 20 74 6f 0d 09 20 69 |heck act|s to.. i|
|00003d50| 6e 73 75 72 65 20 74 68 | 61 74 20 79 6f 75 72 20 |nsure th|at your |
|00003d60| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 69 73 20 73 |applicat|ion is s|
|00003d70| 74 61 72 74 69 6e 67 20 | 66 72 6f 6d 20 61 20 73 |tarting |from a s|
|00003d80| 6f 6c 69 64 20 6d 65 6d | 6f 72 79 20 66 6f 75 6e |olid mem|ory foun|
|00003d90| 64 61 74 69 6f 6e 2e 7d | 0d 09 20 0d 09 49 46 20 |dation.}|.. ..IF |
|00003da0| 4f 52 44 28 47 65 74 41 | 70 70 6c 4c 69 6d 69 74 |ORD(GetA|pplLimit|
|00003db0| 29 20 2d 20 4f 52 44 28 | 41 70 70 6c 69 63 5a 6f |) - ORD(|ApplicZo|
|00003dc0| 6e 65 29 20 3c 20 6b 4d | 69 6e 48 65 61 70 20 54 |ne) < kM|inHeap T|
|00003dd0| 48 45 4e 20 41 6c 65 72 | 74 55 73 65 72 3b 0d 09 |HEN Aler|tUser;..|
|00003de0| 0d 09 7b 4e 65 78 74 2c | 20 6d 61 6b 65 20 73 75 |..{Next,| make su|
|00003df0| 72 65 20 74 68 61 74 20 | 65 6e 6f 75 67 68 20 6d |re that |enough m|
|00003e00| 65 6d 6f 72 79 20 69 73 | 20 66 72 65 65 20 66 6f |emory is| free fo|
|00003e10| 72 20 79 6f 75 72 20 61 | 70 70 6c 69 63 61 74 69 |r your a|pplicati|
|00003e20| 6f 6e 20 74 6f 20 72 75 | 6e 2e 20 49 74 0d 09 20 |on to ru|n. It.. |
|00003e30| 69 73 20 70 6f 73 73 69 | 62 6c 65 20 66 6f 72 20 |is possi|ble for |
|00003e40| 61 20 73 69 74 75 61 74 | 69 6f 6e 20 74 6f 20 61 |a situat|ion to a|
|00003e50| 72 69 73 65 20 77 68 65 | 72 65 20 74 68 65 20 68 |rise whe|re the h|
|00003e60| 65 61 70 20 6d 61 79 20 | 68 61 76 65 20 62 65 65 |eap may |have bee|
|00003e70| 6e 20 6f 66 20 72 65 71 | 75 69 72 65 64 0d 09 20 |n of req|uired.. |
|00003e80| 73 69 7a 65 2c 20 62 75 | 74 20 61 20 6c 61 72 67 |size, bu|t a larg|
|00003e90| 65 20 73 63 72 61 70 20 | 77 61 73 20 6c 6f 61 64 |e scrap |was load|
|00003ea0| 65 64 20 77 68 69 63 68 | 20 6c 65 66 74 20 74 6f |ed which| left to|
|00003eb0| 6f 20 6c 69 74 74 6c 65 | 20 6d 65 6d 6f 72 79 2e |o little| memory.|
|00003ec0| 20 54 6f 20 63 68 65 63 | 6b 20 66 6f 72 0d 09 20 | To chec|k for.. |
|00003ed0| 74 68 69 73 2c 20 63 61 | 6c 6c 20 50 75 72 67 65 |this, ca|ll Purge|
|00003ee0| 53 70 61 63 65 20 61 6e | 64 20 63 6f 6d 70 61 72 |Space an|d compar|
|00003ef0| 65 20 74 68 65 20 72 65 | 73 75 6c 74 20 77 69 74 |e the re|sult wit|
|00003f00| 68 20 61 20 76 61 6c 75 | 65 20 74 68 61 74 20 79 |h a valu|e that y|
|00003f10| 6f 75 20 68 61 76 65 20 | 64 65 74 65 72 6d 69 6e |ou have |determin|
|00003f20| 65 64 0d 09 20 69 73 20 | 74 68 65 20 6d 69 6e 69 |ed.. is |the mini|
|00003f30| 6d 75 6d 20 61 6d 6f 75 | 6e 74 20 6f 66 20 66 72 |mum amou|nt of fr|
|00003f40| 65 65 20 6d 65 6d 6f 72 | 79 20 79 6f 75 72 20 61 |ee memor|y your a|
|00003f50| 70 70 6c 69 63 61 74 69 | 6f 6e 20 6e 65 65 64 73 |pplicati|on needs|
|00003f60| 20 61 74 20 69 6e 69 74 | 69 61 6c 69 7a 61 74 69 | at init|ializati|
|00003f70| 6f 6e 2e 0d 09 20 54 68 | 69 73 20 6e 75 6d 62 65 |on... Th|is numbe|
|00003f80| 72 20 63 61 6e 20 62 65 | 20 64 65 72 69 76 65 64 |r can be| derived|
|00003f90| 20 73 65 76 65 72 61 6c | 20 64 69 66 66 65 72 65 | several| differe|
|00003fa0| 6e 74 20 77 61 79 73 2e | 20 4f 6e 65 20 77 61 79 |nt ways.| One way|
|00003fb0| 20 74 68 61 74 20 69 73 | 20 66 61 69 72 6c 79 0d | that is| fairly.|
|00003fc0| 09 20 73 74 72 61 69 67 | 68 74 66 6f 72 77 61 72 |. straig|htforwar|
|00003fd0| 64 20 69 73 20 74 6f 20 | 72 75 6e 20 74 68 65 20 |d is to |run the |
|00003fe0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 69 6e 20 74 |applicat|ion in t|
|00003ff0| 68 65 20 6d 69 6e 69 6d | 75 6d 20 73 69 7a 65 20 |he minim|um size |
|00004000| 63 6f 6e 66 69 67 75 72 | 61 74 69 6f 6e 0d 09 20 |configur|ation.. |
|00004010| 61 73 20 64 65 73 63 72 | 69 62 65 64 20 70 72 65 |as descr|ibed pre|
|00004020| 76 69 6f 75 73 6c 79 2e | 20 43 61 6c 6c 20 50 75 |viously.| Call Pu|
|00004030| 72 67 65 53 70 61 63 65 | 20 61 74 20 69 6e 69 74 |rgeSpace| at init|
|00004040| 69 61 6c 69 7a 61 74 69 | 6f 6e 20 61 6e 64 20 65 |ializati|on and e|
|00004050| 78 61 6d 69 6e 65 20 74 | 68 65 20 76 61 6c 75 65 |xamine t|he value|
|00004060| 0d 09 20 72 65 74 75 72 | 6e 65 64 2e 20 48 6f 77 |.. retur|ned. How|
|00004070| 65 76 65 72 2c 20 79 6f | 75 20 73 68 6f 75 6c 64 |ever, yo|u should|
|00004080| 20 6d 61 6b 65 20 73 75 | 72 65 20 74 68 61 74 20 | make su|re that |
|00004090| 74 68 69 73 20 72 65 73 | 75 6c 74 20 69 73 20 6e |this res|ult is n|
|000040a0| 6f 74 20 62 65 69 6e 67 | 20 6d 6f 64 69 66 69 65 |ot being| modifie|
|000040b0| 64 0d 09 20 62 79 20 74 | 68 65 20 73 63 72 61 70 |d.. by t|he scrap|
|000040c0| 27 73 20 70 72 65 73 65 | 6e 63 65 2e 20 59 6f 75 |'s prese|nce. You|
|000040d0| 20 63 61 6e 20 64 6f 20 | 74 68 61 74 20 62 79 20 | can do |that by |
|000040e0| 63 61 6c 6c 69 6e 67 20 | 5a 65 72 6f 53 63 72 61 |calling |ZeroScra|
|000040f0| 70 20 62 65 66 6f 72 65 | 20 63 61 6c 6c 69 6e 67 |p before| calling|
|00004100| 0d 09 20 50 75 72 67 65 | 53 70 61 63 65 2e 20 4d |.. Purge|Space. M|
|00004110| 61 6b 65 20 73 75 72 65 | 20 74 6f 20 72 65 6d 6f |ake sure| to remo|
|00004120| 76 65 20 74 68 61 74 20 | 63 61 6c 6c 20 62 65 66 |ve that |call bef|
|00004130| 6f 72 65 20 73 68 69 70 | 70 69 6e 67 2c 20 74 68 |ore ship|ping, th|
|00004140| 6f 75 67 68 2e 7d 0d 09 | 20 0d 09 50 75 72 67 65 |ough.}..| ..Purge|
|00004150| 53 70 61 63 65 28 74 6f | 74 61 6c 2c 20 63 6f 6e |Space(to|tal, con|
|00004160| 74 69 67 29 3b 0d 09 49 | 46 20 74 6f 74 61 6c 20 |tig);..I|F total |
|00004170| 3c 20 6b 4d 69 6e 53 70 | 61 63 65 20 54 48 45 4e |< kMinSp|ace THEN|
|00004180| 20 41 6c 65 72 74 55 73 | 65 72 3b 0d 0d 09 7b 54 | AlertUs|er;...{T|
|00004190| 68 65 20 65 78 74 72 61 | 20 62 65 6e 65 66 69 74 |he extra| benefit|
|000041a0| 20 74 6f 20 77 61 69 74 | 6e 67 20 75 6e 74 69 6c | to wait|ng until|
|000041b0| 20 61 66 74 65 72 20 74 | 68 65 20 54 6f 6f 6c 62 | after t|he Toolb|
|000041c0| 6f 78 20 4d 61 6e 61 67 | 65 72 73 20 68 61 76 65 |ox Manag|ers have|
|000041d0| 20 62 65 65 6e 20 69 6e | 69 74 69 61 6c 69 7a 65 | been in|itialize|
|000041e0| 64 0d 09 20 62 65 66 6f | 72 65 20 63 68 65 63 6b |d.. befo|re check|
|000041f0| 69 6e 67 20 6d 65 6d 6f | 72 79 20 69 73 20 74 68 |ing memo|ry is th|
|00004200| 61 74 20 77 65 20 63 61 | 6e 20 6e 6f 77 20 67 69 |at we ca|n now gi|
|00004210| 76 65 20 74 68 65 20 75 | 73 65 72 20 61 6e 20 61 |ve the u|ser an a|
|00004220| 6c 65 72 74 20 74 6f 20 | 74 65 6c 6c 20 68 69 6d |lert to |tell him|
|00004230| 20 77 68 61 74 0d 09 20 | 68 61 70 70 65 6e 65 64 | what.. |happened|
|00004240| 2e 20 41 6c 74 68 6f 75 | 67 68 20 69 74 20 69 73 |. Althou|gh it is|
|00004250| 20 70 6f 73 73 69 62 6c | 65 20 74 68 61 74 20 74 | possibl|e that t|
|00004260| 68 65 20 6d 65 6d 6f 72 | 79 20 73 69 74 75 61 74 |he memor|y situat|
|00004270| 69 6f 6e 20 63 6f 75 6c | 64 20 62 65 20 77 6f 72 |ion coul|d be wor|
|00004280| 73 65 6e 65 64 20 62 79 | 0d 09 20 64 69 73 70 6c |sened by|.. displ|
|00004290| 61 79 69 6e 67 20 61 6e | 20 61 6c 65 72 74 2c 20 |aying an| alert, |
|000042a0| 4d 75 6c 74 69 46 69 6e | 64 65 72 20 77 6f 75 6c |MultiFin|der woul|
|000042b0| 64 20 67 72 61 63 65 66 | 75 6c 6c 79 20 65 78 69 |d gracef|ully exi|
|000042c0| 74 20 74 68 65 20 61 70 | 70 6c 69 63 61 74 69 6f |t the ap|plicatio|
|000042d0| 6e 20 77 69 74 68 0d 09 | 20 61 6e 20 69 6e 66 6f |n with..| an info|
|000042e0| 72 6d 61 74 69 76 65 20 | 61 6c 65 72 74 20 69 66 |rmative |alert if|
|000042f0| 20 6d 65 6d 6f 72 79 20 | 62 65 63 61 6d 65 20 63 | memory |became c|
|00004300| 72 69 74 69 63 61 6c 2e | 20 48 65 72 65 20 77 65 |ritical.| Here we|
|00004310| 20 61 72 65 20 61 63 74 | 69 6e 67 20 6d 6f 72 65 | are act|ing more|
|00004320| 0d 09 20 69 6e 20 61 20 | 70 72 65 76 65 6e 74 61 |.. in a |preventa|
|00004330| 74 69 76 65 20 6d 61 6e | 6e 65 72 20 74 6f 20 61 |tive man|ner to a|
|00004340| 76 6f 69 64 20 66 75 74 | 75 72 65 20 64 69 73 61 |void fut|ure disa|
|00004350| 73 74 65 72 20 66 72 6f | 6d 20 6c 6f 77 2d 6d 65 |ster fro|m low-me|
|00004360| 6d 6f 72 79 20 70 72 6f | 62 6c 65 6d 73 2e 7d 0d |mory pro|blems.}.|
|00004370| 09 20 0d 09 7b 57 65 20 | 77 69 6c 6c 20 61 6c 6c |. ..{We |will all|
|00004380| 6f 63 61 74 65 20 6f 75 | 72 20 6f 77 6e 20 77 69 |ocate ou|r own wi|
|00004390| 6e 64 6f 77 20 73 74 6f | 72 61 67 65 20 69 6e 73 |ndow sto|rage ins|
|000043a0| 74 65 61 64 20 6f 66 20 | 6c 65 74 74 69 6e 67 20 |tead of |letting |
|000043b0| 74 68 65 20 57 69 6e 64 | 6f 77 0d 09 20 4d 61 6e |the Wind|ow.. Man|
|000043c0| 61 67 65 72 20 66 6f 72 | 20 74 77 6f 20 72 65 61 |ager for| two rea|
|000043d0| 73 6f 6e 73 2e 20 4f 6e | 65 2c 20 47 65 74 4e 65 |sons. On|e, GetNe|
|000043e0| 77 57 69 6e 64 6f 77 20 | 6c 6f 63 6b 73 20 74 68 |wWindow |locks th|
|000043f0| 65 20 27 57 49 4e 44 27 | 20 72 65 73 6f 75 72 63 |e 'WIND'| resourc|
|00004400| 65 0d 09 20 68 61 6e 64 | 6c 65 20 62 65 66 6f 72 |e.. hand|le befor|
|00004410| 65 20 63 61 6c 6c 69 6e | 67 20 4e 65 77 57 69 6e |e callin|g NewWin|
|00004420| 64 6f 77 20 61 6e 64 20 | 74 68 69 73 20 63 61 6e |dow and |this can|
|00004430| 20 6c 65 61 64 20 74 6f | 20 68 65 61 70 20 66 72 | lead to| heap fr|
|00004440| 61 67 6d 65 6e 74 61 74 | 69 6f 6e 2e 0d 09 20 54 |agmentat|ion... T|
|00004450| 77 6f 2c 20 69 74 20 74 | 61 6b 65 73 20 6a 75 73 |wo, it t|akes jus|
|00004460| 74 20 61 73 20 6d 75 63 | 68 20 74 69 6d 65 20 66 |t as muc|h time f|
|00004470| 6f 72 20 4e 65 77 57 69 | 6e 64 6f 77 20 74 6f 20 |or NewWi|ndow to |
|00004480| 67 65 74 20 74 68 65 20 | 6d 65 6d 6f 72 79 20 61 |get the |memory a|
|00004490| 73 20 69 74 0d 09 20 64 | 6f 65 73 20 66 6f 72 20 |s it.. d|oes for |
|000044a0| 75 73 20 74 6f 20 67 65 | 74 20 69 74 2e 7d 0d 0d |us to ge|t it.}..|
|000044b0| 09 77 69 6e 64 6f 77 20 | 3a 3d 20 57 69 6e 64 6f |.window |:= Windo|
|000044c0| 77 50 74 72 28 4e 65 77 | 50 74 72 28 53 49 5a 45 |wPtr(New|Ptr(SIZE|
|000044d0| 4f 46 28 57 69 6e 64 6f | 77 52 65 63 6f 72 64 29 |OF(Windo|wRecord)|
|000044e0| 29 29 3b 0d 09 49 46 20 | 77 69 6e 64 6f 77 20 3d |));..IF |window =|
|000044f0| 20 4e 49 4c 20 54 48 45 | 4e 20 41 6c 65 72 74 55 | NIL THE|N AlertU|
|00004500| 73 65 72 3b 0d 09 77 69 | 6e 64 6f 77 20 3a 3d 20 |ser;..wi|ndow := |
|00004510| 47 65 74 4e 65 77 57 69 | 6e 64 6f 77 28 72 57 69 |GetNewWi|ndow(rWi|
|00004520| 6e 64 6f 77 2c 20 50 74 | 72 28 77 69 6e 64 6f 77 |ndow, Pt|r(window|
|00004530| 29 2c 20 57 69 6e 64 6f | 77 50 74 72 28 2d 31 29 |), Windo|wPtr(-1)|
|00004540| 29 3b 0d 0d 09 6d 65 6e | 75 42 61 72 20 3a 3d 20 |);...men|uBar := |
|00004550| 47 65 74 4e 65 77 4d 42 | 61 72 28 72 4d 65 6e 75 |GetNewMB|ar(rMenu|
|00004560| 42 61 72 29 3b 09 09 7b | 72 65 61 64 20 6d 65 6e |Bar);..{|read men|
|00004570| 75 73 20 69 6e 74 6f 20 | 6d 65 6e 75 20 62 61 72 |us into |menu bar|
|00004580| 7d 0d 09 49 46 20 6d 65 | 6e 75 42 61 72 20 3d 20 |}..IF me|nuBar = |
|00004590| 4e 49 4c 20 54 48 45 4e | 20 41 6c 65 72 74 55 73 |NIL THEN| AlertUs|
|000045a0| 65 72 3b 0d 09 53 65 74 | 4d 65 6e 75 42 61 72 28 |er;..Set|MenuBar(|
|000045b0| 6d 65 6e 75 42 61 72 29 | 3b 09 09 09 09 09 7b 69 |menuBar)|;.....{i|
|000045c0| 6e 73 74 61 6c 6c 20 6d | 65 6e 75 73 7d 0d 09 44 |nstall m|enus}..D|
|000045d0| 69 73 70 6f 73 48 61 6e | 64 6c 65 28 6d 65 6e 75 |isposHan|dle(menu|
|000045e0| 42 61 72 29 3b 0d 09 41 | 64 64 52 65 73 4d 65 6e |Bar);..A|ddResMen|
|000045f0| 75 28 47 65 74 4d 48 61 | 6e 64 6c 65 28 6d 41 70 |u(GetMHa|ndle(mAp|
|00004600| 70 6c 65 29 2c 20 27 44 | 52 56 52 27 29 3b 09 7b |ple), 'D|RVR');.{|
|00004610| 61 64 64 20 44 41 20 6e | 61 6d 65 73 20 74 6f 20 |add DA n|ames to |
|00004620| 41 70 70 6c 65 20 6d 65 | 6e 75 7d 0d 09 44 72 61 |Apple me|nu}..Dra|
|00004630| 77 4d 65 6e 75 42 61 72 | 3b 0d 0d 09 67 53 74 6f |wMenuBar|;...gSto|
|00004640| 70 70 65 64 20 3a 3d 20 | 54 52 55 45 3b 0d 09 49 |pped := |TRUE;..I|
|00004650| 46 20 4e 4f 54 20 47 6f | 47 65 74 52 65 63 74 28 |F NOT Go|GetRect(|
|00004660| 72 53 74 6f 70 52 65 63 | 74 2c 20 67 53 74 6f 70 |rStopRec|t, gStop|
|00004670| 52 65 63 74 29 20 54 48 | 45 4e 0d 09 09 41 6c 65 |Rect) TH|EN...Ale|
|00004680| 72 74 55 73 65 72 3b 09 | 09 09 09 09 09 09 7b 74 |rtUser;.|......{t|
|00004690| 68 65 20 73 74 6f 70 20 | 6c 69 67 68 74 20 72 65 |he stop |light re|
|000046a0| 63 74 61 6e 67 6c 65 7d | 0d 09 49 46 20 4e 4f 54 |ctangle}|..IF NOT|
|000046b0| 20 47 6f 47 65 74 52 65 | 63 74 28 72 47 6f 52 65 | GoGetRe|ct(rGoRe|
|000046c0| 63 74 2c 20 67 47 6f 52 | 65 63 74 29 20 54 48 45 |ct, gGoR|ect) THE|
|000046d0| 4e 0d 09 09 41 6c 65 72 | 74 55 73 65 72 3b 09 09 |N...Aler|tUser;..|
|000046e0| 09 09 09 09 09 7b 74 68 | 65 20 67 6f 20 6c 69 67 |.....{th|e go lig|
|000046f0| 68 74 20 72 65 63 74 61 | 6e 67 6c 65 7d 0d 45 4e |ht recta|ngle}.EN|
|00004700| 44 3b 20 7b 49 6e 69 74 | 69 61 6c 69 7a 65 7d 0d |D; {Init|ialize}.|
|00004710| 0d 0d 28 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |..(*****|********|
|00004720| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004730| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004740| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004750| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004760| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 0d 31 2e 30 31 20 2d |********|*.1.01 -|
|00004770| 20 50 52 4f 43 45 44 55 | 52 45 20 44 6f 43 6c 6f | PROCEDU|RE DoClo|
|00004780| 73 65 42 65 68 69 6e 64 | 28 77 69 6e 64 6f 77 3a |seBehind|(window:|
|00004790| 20 57 69 6e 64 6f 77 50 | 74 72 29 3b 20 77 61 73 | WindowP|tr); was|
|000047a0| 20 72 65 6d 6f 76 65 64 | 2e 0d 0d 7b 31 2e 30 31 | removed|...{1.01|
|000047b0| 20 2d 20 44 6f 43 6c 6f | 73 65 42 65 68 69 6e 64 | - DoClo|seBehind|
|000047c0| 20 77 61 73 20 61 20 67 | 6f 6f 64 20 69 64 65 61 | was a g|ood idea|
|000047d0| 20 66 6f 72 20 63 6c 6f | 73 69 6e 67 20 77 69 6e | for clo|sing win|
|000047e0| 64 6f 77 73 20 77 68 65 | 6e 20 71 75 69 74 74 69 |dows whe|n quitti|
|000047f0| 6e 67 0d 20 61 6e 64 20 | 6e 6f 74 20 68 61 76 69 |ng. and |not havi|
|00004800| 6e 67 20 74 6f 20 77 6f | 72 72 79 20 61 62 6f 75 |ng to wo|rry abou|
|00004810| 74 20 75 70 64 61 74 69 | 6e 67 20 74 68 65 20 77 |t updati|ng the w|
|00004820| 69 6e 64 6f 77 73 2c 20 | 62 75 74 20 69 74 20 73 |indows, |but it s|
|00004830| 75 66 66 65 72 65 64 0d | 20 66 72 6f 6d 20 61 20 |uffered.| from a |
|00004840| 66 61 74 61 6c 20 66 6c | 61 77 2e 20 49 66 20 61 |fatal fl|aw. If a|
|00004850| 20 64 65 73 6b 20 61 63 | 63 65 73 73 6f 72 79 20 | desk ac|cessory |
|00004860| 6f 77 6e 65 64 20 74 77 | 6f 20 77 69 6e 64 6f 77 |owned tw|o window|
|00004870| 73 2c 20 69 74 20 77 6f | 75 6c 64 0d 20 63 6c 6f |s, it wo|uld. clo|
|00004880| 73 65 20 62 6f 74 68 20 | 74 68 6f 73 65 20 77 69 |se both |those wi|
|00004890| 6e 64 6f 77 73 20 77 68 | 65 6e 20 43 6c 6f 73 65 |ndows wh|en Close|
|000048a0| 44 65 73 6b 41 63 63 20 | 77 61 73 20 63 61 6c 6c |DeskAcc |was call|
|000048b0| 65 64 2e 20 57 68 65 6e | 20 44 6f 43 6c 6f 73 65 |ed. When| DoClose|
|000048c0| 42 65 68 69 6e 64 0d 20 | 67 6f 74 20 61 72 6f 75 |Behind. |got arou|
|000048d0| 6e 64 20 74 6f 20 63 61 | 6c 6c 69 6e 67 20 44 6f |nd to ca|lling Do|
|000048e0| 43 6c 6f 73 65 57 69 6e | 64 6f 77 20 66 6f 72 20 |CloseWin|dow for |
|000048f0| 74 68 61 74 20 6f 74 68 | 65 72 20 77 69 6e 64 6f |that oth|er windo|
|00004900| 77 20 74 68 61 74 20 77 | 61 73 20 61 6c 72 65 61 |w that w|as alrea|
|00004910| 64 79 0d 20 63 6c 6f 73 | 65 64 2c 20 74 68 69 6e |dy. clos|ed, thin|
|00004920| 67 73 20 77 6f 75 6c 64 | 20 67 6f 20 76 65 72 79 |gs would| go very|
|00004930| 20 70 6f 6f 72 6c 79 2e | 20 41 6e 6f 74 68 65 72 | poorly.| Another|
|00004940| 20 6f 70 74 69 6f 6e 20 | 77 6f 75 6c 64 20 62 65 | option |would be|
|00004950| 20 74 6f 20 68 61 76 65 | 20 61 0d 20 70 72 6f 63 | to have| a. proc|
|00004960| 65 64 75 72 65 2c 20 47 | 65 74 52 65 61 72 57 69 |edure, G|etRearWi|
|00004970| 6e 64 6f 77 2c 20 74 68 | 61 74 20 77 6f 75 6c 64 |ndow, th|at would|
|00004980| 20 67 6f 20 74 68 72 6f | 75 67 68 20 74 68 65 20 | go thro|ugh the |
|00004990| 77 69 6e 64 6f 77 20 6c | 69 73 74 20 61 6e 64 20 |window l|ist and |
|000049a0| 72 65 74 75 72 6e 0d 20 | 74 68 65 20 6c 61 73 74 |return. |the last|
|000049b0| 20 77 69 6e 64 6f 77 2e | 20 49 6e 73 74 65 61 64 | window.| Instead|
|000049c0| 2c 20 77 65 20 64 65 63 | 69 64 65 64 20 74 6f 20 |, we dec|ided to |
|000049d0| 70 72 65 73 65 6e 74 20 | 74 68 65 20 73 74 61 6e |present |the stan|
|000049e0| 64 61 72 64 20 61 70 70 | 72 6f 61 63 68 0d 20 6f |dard app|roach. o|
|000049f0| 66 20 67 65 74 74 69 6e | 67 20 61 6e 64 20 63 6c |f gettin|g and cl|
|00004a00| 6f 73 69 6e 67 20 46 72 | 6f 6e 74 57 69 6e 64 6f |osing Fr|ontWindo|
|00004a10| 77 20 75 6e 74 69 6c 20 | 46 72 6f 6e 74 57 69 6e |w until |FrontWin|
|00004a20| 64 6f 77 20 72 65 74 75 | 72 6e 73 20 4e 49 4c 2e |dow retu|rns NIL.|
|00004a30| 20 54 68 69 73 0d 20 68 | 61 73 20 61 20 70 6f 74 | This. h|as a pot|
|00004a40| 65 6e 74 69 61 6c 20 62 | 65 6e 65 66 69 74 20 69 |ential b|enefit i|
|00004a50| 6e 20 74 68 61 74 20 74 | 68 65 20 77 69 6e 64 6f |n that t|he windo|
|00004a60| 77 20 77 68 6f 73 65 20 | 64 6f 63 75 6d 65 6e 74 |w whose |document|
|00004a70| 20 6e 65 65 64 73 20 74 | 6f 20 62 65 20 73 61 76 | needs t|o be sav|
|00004a80| 65 64 0d 20 6d 61 79 20 | 62 65 20 76 69 73 69 62 |ed. may |be visib|
|00004a90| 6c 65 20 73 69 6e 63 65 | 20 69 74 20 69 73 20 74 |le since| it is t|
|00004aa0| 68 65 20 66 72 6f 6e 74 | 20 77 69 6e 64 6f 77 2c |he front| window,|
|00004ab0| 20 74 68 65 72 65 66 6f | 72 65 20 64 65 63 72 65 | therefo|re decre|
|00004ac0| 61 73 69 6e 67 20 74 68 | 65 0d 20 63 68 61 6e 63 |asing th|e. chanc|
|00004ad0| 65 20 6f 66 20 75 73 65 | 72 20 63 6f 6e 66 75 73 |e of use|r confus|
|00004ae0| 69 6f 6e 2e 20 46 6f 72 | 20 61 65 73 74 68 65 74 |ion. For| aesthet|
|00004af0| 69 63 20 72 65 61 73 6f | 6e 73 2c 20 74 68 65 20 |ic reaso|ns, the |
|00004b00| 77 69 6e 64 6f 77 73 20 | 69 6e 20 74 68 65 0d 20 |windows |in the. |
|00004b10| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 73 68 6f 75 |applicat|ion shou|
|00004b20| 6c 64 20 62 65 20 63 68 | 65 63 6b 65 64 20 66 6f |ld be ch|ecked fo|
|00004b30| 72 20 75 70 64 61 74 65 | 73 20 70 65 72 69 6f 64 |r update|s period|
|00004b40| 69 63 61 6c 6c 79 20 61 | 6e 64 20 68 61 76 65 20 |ically a|nd have |
|00004b50| 74 68 65 0d 20 75 70 64 | 61 74 65 73 20 73 65 72 |the. upd|ates ser|
|00004b60| 76 69 63 65 64 2e 7d 0d | 2a 2a 2a 2a 2a 2a 2a 2a |viced.}.|********|
|00004b70| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004b80| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004b90| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004ba0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 2a 2a |********|********|
|00004bb0| 2a 2a 2a 2a 2a 2a 2a 2a | 2a 2a 2a 2a 2a 2a 29 0d |********|******).|
|00004bc0| 0d 0d 7b 24 53 20 4d 61 | 69 6e 7d 0d 50 52 4f 43 |..{$S Ma|in}.PROC|
|00004bd0| 45 44 55 52 45 20 54 65 | 72 6d 69 6e 61 74 65 3b |EDURE Te|rminate;|
|00004be0| 0d 0d 7b 43 6c 65 61 6e | 20 75 70 20 74 68 65 20 |..{Clean| up the |
|00004bf0| 61 70 70 6c 69 63 61 74 | 69 6f 6e 20 61 6e 64 20 |applicat|ion and |
|00004c00| 65 78 69 74 73 2e 20 57 | 65 20 63 6c 6f 73 65 20 |exits. W|e close |
|00004c10| 61 6c 6c 20 6f 66 20 74 | 68 65 20 77 69 6e 64 6f |all of t|he windo|
|00004c20| 77 73 20 73 6f 20 74 68 | 61 74 0d 20 74 68 65 79 |ws so th|at. they|
|00004c30| 20 63 61 6e 20 75 70 64 | 61 74 65 20 74 68 65 69 | can upd|ate thei|
|00004c40| 72 20 64 6f 63 75 6d 65 | 6e 74 73 2c 20 69 66 20 |r docume|nts, if |
|00004c50| 61 6e 79 2e 7d 0d 20 0d | 7b 31 2e 30 31 20 2d 20 |any.}. .|{1.01 - |
|00004c60| 49 66 20 77 65 20 66 69 | 6e 64 20 6f 75 74 20 74 |If we fi|nd out t|
|00004c70| 68 61 74 20 61 20 63 61 | 6e 63 65 6c 20 68 61 73 |hat a ca|ncel has|
|00004c80| 20 6f 63 63 75 72 72 65 | 64 2c 20 77 65 20 77 6f | occurre|d, we wo|
|00004c90| 6e 27 74 20 65 78 69 74 | 20 74 6f 20 74 68 65 0d |n't exit| to the.|
|00004ca0| 20 73 68 65 6c 6c 2c 20 | 62 75 74 20 77 69 6c 6c | shell, |but will|
|00004cb0| 20 72 65 74 75 72 6e 20 | 69 6e 73 74 65 61 64 2e | return |instead.|
|00004cc0| 7d 0d 20 0d 56 41 52 0d | 09 61 57 69 6e 64 6f 77 |}. .VAR.|.aWindow|
|00004cd0| 09 3a 20 57 69 6e 64 6f | 77 50 74 72 3b 0d 09 63 |.: Windo|wPtr;..c|
|00004ce0| 6c 6f 73 65 64 09 3a 20 | 42 4f 4f 4c 45 41 4e 3b |losed.: |BOOLEAN;|
|00004cf0| 0d 0d 42 45 47 49 4e 0d | 09 63 6c 6f 73 65 64 20 |..BEGIN.|.closed |
|00004d00| 3a 3d 20 54 52 55 45 3b | 0d 09 52 45 50 45 41 54 |:= TRUE;|..REPEAT|
|00004d10| 0d 09 09 61 57 69 6e 64 | 6f 77 20 3a 3d 20 46 72 |...aWind|ow := Fr|
|00004d20| 6f 6e 74 57 69 6e 64 6f | 77 3b 09 09 09 09 09 7b |ontWindo|w;.....{|
|00004d30| 67 65 74 20 74 68 65 20 | 63 75 72 72 65 6e 74 20 |get the |current |
|00004d40| 66 72 6f 6e 74 20 77 69 | 6e 64 6f 77 7d 0d 09 09 |front wi|ndow}...|
|00004d50| 49 46 20 61 57 69 6e 64 | 6f 77 20 3c 3e 20 4e 49 |IF aWind|ow <> NI|
|00004d60| 4c 20 54 48 45 4e 0d 09 | 09 09 63 6c 6f 73 65 64 |L THEN..|..closed|
|00004d70| 20 3a 3d 20 44 6f 43 6c | 6f 73 65 57 69 6e 64 6f | := DoCl|oseWindo|
|00004d80| 77 28 61 57 69 6e 64 6f | 77 29 3b 09 7b 63 6c 6f |w(aWindo|w);.{clo|
|00004d90| 73 65 20 74 68 69 73 20 | 77 69 6e 64 6f 77 7d 0d |se this |window}.|
|00004da0| 09 55 4e 54 49 4c 20 28 | 4e 4f 54 20 63 6c 6f 73 |.UNTIL (|NOT clos|
|00004db0| 65 64 29 20 7c 20 28 61 | 57 69 6e 64 6f 77 20 3d |ed) | (a|Window =|
|00004dc0| 20 4e 49 4c 29 3b 09 09 | 7b 64 6f 20 61 6c 6c 20 | NIL);..|{do all |
|00004dd0| 77 69 6e 64 6f 77 73 7d | 0d 09 49 46 20 63 6c 6f |windows}|..IF clo|
|00004de0| 73 65 64 20 54 48 45 4e | 0d 09 09 45 78 69 74 54 |sed THEN|...ExitT|
|00004df0| 6f 53 68 65 6c 6c 3b 09 | 09 09 09 09 09 09 7b 65 |oShell;.|......{e|
|00004e00| 78 69 74 20 69 66 20 6e | 6f 20 63 61 6e 63 65 6c |xit if n|o cancel|
|00004e10| 6c 61 74 69 6f 6e 7d 0d | 45 4e 44 3b 20 7b 54 65 |lation}.|END; {Te|
|00004e20| 72 6d 69 6e 61 74 65 7d | 0d 0d 0d 7b 24 53 20 4d |rminate}|...{$S M|
|00004e30| 61 69 6e 7d 0d 50 52 4f | 43 45 44 55 52 45 20 53 |ain}.PRO|CEDURE S|
|00004e40| 65 74 4c 69 67 68 74 28 | 77 69 6e 64 6f 77 3a 20 |etLight(|window: |
|00004e50| 57 69 6e 64 6f 77 50 74 | 72 3b 20 6e 65 77 53 74 |WindowPt|r; newSt|
|00004e60| 6f 70 70 65 64 3a 20 42 | 4f 4f 4c 45 41 4e 29 3b |opped: B|OOLEAN);|
|00004e70| 0d 0d 7b 43 68 61 6e 67 | 65 20 74 68 65 20 73 65 |..{Chang|e the se|
|00004e80| 74 74 69 6e 67 20 6f 66 | 20 74 68 65 20 6c 69 67 |tting of| the lig|
|00004e90| 68 74 2e 7d 0d 0d 42 45 | 47 49 4e 0d 09 49 46 20 |ht.}..BE|GIN..IF |
|00004ea0| 6e 65 77 53 74 6f 70 70 | 65 64 20 3c 3e 20 67 53 |newStopp|ed <> gS|
|00004eb0| 74 6f 70 70 65 64 20 54 | 48 45 4e 20 42 45 47 49 |topped T|HEN BEGI|
|00004ec0| 4e 0d 09 09 67 53 74 6f | 70 70 65 64 20 3a 3d 20 |N...gSto|pped := |
|00004ed0| 6e 65 77 53 74 6f 70 70 | 65 64 3b 0d 09 09 53 65 |newStopp|ed;...Se|
|00004ee0| 74 50 6f 72 74 28 77 69 | 6e 64 6f 77 29 3b 0d 09 |tPort(wi|ndow);..|
|00004ef0| 09 49 6e 76 61 6c 52 65 | 63 74 28 77 69 6e 64 6f |.InvalRe|ct(windo|
|00004f00| 77 5e 2e 70 6f 72 74 52 | 65 63 74 29 3b 0d 09 45 |w^.portR|ect);..E|
|00004f10| 4e 44 3b 0d 45 4e 44 3b | 20 7b 53 65 74 4c 69 67 |ND;.END;| {SetLig|
|00004f20| 68 74 7d 0d 0d 0d 7b 24 | 53 20 4d 61 69 6e 7d 0d |ht}...{$|S Main}.|
|00004f30| 50 52 4f 43 45 44 55 52 | 45 20 41 64 6a 75 73 74 |PROCEDUR|E Adjust|
|00004f40| 4d 65 6e 75 73 3b 0d 0d | 7b 45 6e 61 62 6c 65 20 |Menus;..|{Enable |
|00004f50| 61 6e 64 20 64 69 73 61 | 62 6c 65 20 6d 65 6e 75 |and disa|ble menu|
|00004f60| 73 20 62 61 73 65 64 20 | 6f 6e 20 74 68 65 20 63 |s based |on the c|
|00004f70| 75 72 72 65 6e 74 20 73 | 74 61 74 65 2e 0d 20 54 |urrent s|tate.. T|
|00004f80| 68 65 20 75 73 65 72 20 | 63 61 6e 20 6f 6e 6c 79 |he user |can only|
|00004f90| 20 73 65 6c 65 63 74 20 | 65 6e 61 62 6c 65 64 20 | select |enabled |
|00004fa0| 6d 65 6e 75 20 69 74 65 | 6d 73 2e 20 57 65 20 73 |menu ite|ms. We s|
|00004fb0| 65 74 20 75 70 20 61 6c | 6c 20 74 68 65 20 6d 65 |et up al|l the me|
|00004fc0| 6e 75 20 69 74 65 6d 73 | 0d 20 62 65 66 6f 72 65 |nu items|. before|
|00004fd0| 20 63 61 6c 6c 69 6e 67 | 20 4d 65 6e 75 53 65 6c | calling| MenuSel|
|00004fe0| 65 63 74 20 6f 72 20 4d | 65 6e 75 4b 65 79 2c 20 |ect or M|enuKey, |
|00004ff0| 73 69 6e 63 65 20 74 68 | 65 73 65 20 61 72 65 20 |since th|ese are |
|00005000| 74 68 65 20 6f 6e 6c 79 | 20 74 69 6d 65 73 20 74 |the only| times t|
|00005010| 68 61 74 0d 20 61 20 6d | 65 6e 75 20 69 74 65 6d |hat. a m|enu item|
|00005020| 20 63 61 6e 20 62 65 20 | 73 65 6c 65 63 74 65 64 | can be |selected|
|00005030| 2e 20 4e 6f 74 65 20 74 | 68 61 74 20 4d 65 6e 75 |. Note t|hat Menu|
|00005040| 53 65 6c 65 63 74 20 69 | 73 20 61 6c 73 6f 20 74 |Select i|s also t|
|00005050| 68 65 20 6f 6e 6c 79 20 | 74 69 6d 65 0d 20 74 68 |he only |time. th|
|00005060| 65 20 75 73 65 72 20 77 | 69 6c 6c 20 73 65 65 20 |e user w|ill see |
|00005070| 6d 65 6e 75 20 69 74 65 | 6d 73 2e 20 54 68 69 73 |menu ite|ms. This|
|00005080| 20 61 70 70 72 6f 61 63 | 68 20 74 6f 20 64 65 63 | approac|h to dec|
|00005090| 69 64 69 6e 67 20 77 68 | 61 74 20 65 6e 61 62 6c |iding wh|at enabl|
|000050a0| 65 2f 0d 20 64 69 73 61 | 62 6c 65 20 73 74 61 74 |e/. disa|ble stat|
|000050b0| 65 20 61 20 6d 65 6e 75 | 20 69 74 65 6d 20 68 61 |e a menu| item ha|
|000050c0| 73 20 74 68 65 20 61 64 | 76 61 6e 74 61 67 65 20 |s the ad|vantage |
|000050d0| 6f 66 20 63 6f 6e 63 65 | 6e 74 72 61 74 69 6e 67 |of conce|ntrating|
|000050e0| 20 61 6c 6c 20 74 68 65 | 20 64 65 63 69 73 69 6f | all the| decisio|
|000050f0| 6e 2d 0d 20 6d 61 6b 69 | 6e 67 20 69 6e 20 6f 6e |n-. maki|ng in on|
|00005100| 65 20 72 6f 75 74 69 6e | 65 2c 20 61 73 20 6f 70 |e routin|e, as op|
|00005110| 70 6f 73 65 64 20 74 6f | 20 62 65 69 6e 67 20 73 |posed to| being s|
|00005120| 70 72 65 61 64 20 74 68 | 72 6f 75 67 68 6f 75 74 |pread th|roughout|
|00005130| 20 74 68 65 20 61 70 70 | 6c 69 63 61 74 69 6f 6e | the app|lication|
|00005140| 2e 0d 20 4f 74 68 65 72 | 20 61 70 70 6c 69 63 61 |.. Other| applica|
|00005150| 74 69 6f 6e 20 64 65 73 | 69 67 6e 73 20 6d 61 79 |tion des|igns may|
|00005160| 20 74 61 6b 65 20 61 20 | 64 69 66 66 65 72 65 6e | take a |differen|
|00005170| 74 20 61 70 70 72 6f 61 | 63 68 20 74 68 61 74 20 |t approa|ch that |
|00005180| 6d 61 79 20 6f 72 20 6d | 61 79 20 6e 6f 74 20 62 |may or m|ay not b|
|00005190| 65 0d 20 6a 75 73 74 20 | 61 73 20 76 61 6c 69 64 |e. just |as valid|
|000051a0| 2e 7d 0d 0d 56 41 52 0d | 09 77 69 6e 64 6f 77 09 |.}..VAR.|.window.|
|000051b0| 09 09 3a 20 57 69 6e 64 | 6f 77 50 74 72 3b 0d 09 |..: Wind|owPtr;..|
|000051c0| 6d 65 6e 75 09 09 09 3a | 20 4d 65 6e 75 48 61 6e |menu...:| MenuHan|
|000051d0| 64 6c 65 3b 0d 0d 42 45 | 47 49 4e 0d 09 77 69 6e |dle;..BE|GIN..win|
|000051e0| 64 6f 77 20 3a 3d 20 46 | 72 6f 6e 74 57 69 6e 64 |dow := F|rontWind|
|000051f0| 6f 77 3b 0d 0d 09 6d 65 | 6e 75 20 3a 3d 20 47 65 |ow;...me|nu := Ge|
|00005200| 74 4d 48 61 6e 64 6c 65 | 28 6d 46 69 6c 65 29 3b |tMHandle|(mFile);|
|00005210| 0d 09 49 46 20 49 73 44 | 41 57 69 6e 64 6f 77 28 |..IF IsD|AWindow(|
|00005220| 77 69 6e 64 6f 77 29 20 | 54 48 45 4e 09 09 09 09 |window) |THEN....|
|00005230| 7b 77 65 20 63 61 6e 20 | 61 6c 6c 6f 77 20 64 65 |{we can |allow de|
|00005240| 73 6b 20 61 63 63 65 73 | 73 6f 72 69 65 73 20 74 |sk acces|sories t|
|00005250| 6f 20 62 65 20 63 6c 6f | 73 65 64 20 66 72 6f 6d |o be clo|sed from|
|00005260| 20 74 68 65 20 6d 65 6e | 75 7d 0d 09 09 45 6e 61 | the men|u}...Ena|
|00005270| 62 6c 65 49 74 65 6d 28 | 6d 65 6e 75 2c 20 69 43 |bleItem(|menu, iC|
|00005280| 6c 6f 73 65 29 0d 09 45 | 4c 53 45 0d 09 09 44 69 |lose)..E|LSE...Di|
|00005290| 73 61 62 6c 65 49 74 65 | 6d 28 6d 65 6e 75 2c 20 |sableIte|m(menu, |
|000052a0| 69 43 6c 6f 73 65 29 3b | 09 09 09 7b 62 75 74 20 |iClose);|...{but |
|000052b0| 6e 6f 74 20 6f 75 72 20 | 74 72 61 66 66 69 63 20 |not our |traffic |
|000052c0| 6c 69 67 68 74 20 77 69 | 6e 64 6f 77 7d 0d 0d 09 |light wi|ndow}...|
|000052d0| 6d 65 6e 75 20 3a 3d 20 | 47 65 74 4d 48 61 6e 64 |menu := |GetMHand|
|000052e0| 6c 65 28 6d 45 64 69 74 | 29 3b 0d 09 49 46 20 49 |le(mEdit|);..IF I|
|000052f0| 73 44 41 57 69 6e 64 6f | 77 28 77 69 6e 64 6f 77 |sDAWindo|w(window|
|00005300| 29 20 54 48 45 4e 20 42 | 45 47 49 4e 09 09 7b 61 |) THEN B|EGIN..{a|
|00005310| 20 64 65 73 6b 20 61 63 | 63 65 73 73 6f 72 79 20 | desk ac|cessory |
|00005320| 6d 69 67 68 74 20 6e 65 | 65 64 20 74 68 65 20 65 |might ne|ed the e|
|00005330| 64 69 74 20 6d 65 6e 75 | 7d 0d 09 09 45 6e 61 62 |dit menu|}...Enab|
|00005340| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 55 6e |leItem(m|enu, iUn|
|00005350| 64 6f 29 3b 0d 09 09 45 | 6e 61 62 6c 65 49 74 65 |do);...E|nableIte|
|00005360| 6d 28 6d 65 6e 75 2c 20 | 69 43 75 74 29 3b 0d 09 |m(menu, |iCut);..|
|00005370| 09 45 6e 61 62 6c 65 49 | 74 65 6d 28 6d 65 6e 75 |.EnableI|tem(menu|
|00005380| 2c 20 69 43 6f 70 79 29 | 3b 0d 09 09 45 6e 61 62 |, iCopy)|;...Enab|
|00005390| 6c 65 49 74 65 6d 28 6d | 65 6e 75 2c 20 69 50 61 |leItem(m|enu, iPa|
|000053a0| 73 74 65 29 3b 0d 09 09 | 45 6e 61 62 6c 65 49 74 |ste);...|EnableIt|
|000053b0| 65 6d 28 6d 65 6e 75 2c | 20 69 43 6c 65 61 72 29 |em(menu,| iClear)|
|000053c0| 3b 0d 09 45 4e 44 20 45 | 4c 53 45 20 42 45 47 49 |;..END E|LSE BEGI|
|000053d0| 4e 09 09 09 09 09 09 09 | 7b 62 75 74 20 77 65 20 |N.......|{but we |
|000053e0| 6b 6e 6f 77 20 77 65 20 | 64 6f 20 6e 6f 74 7d 0d |know we |do not}.|
|000053f0| 09 09 44 69 73 61 62 6c | 65 49 74 65 6d 28 6d 65 |..Disabl|eItem(me|
|00005400| 6e 75 2c 20 69 55 6e 64 | 6f 29 3b 0d 09 09 44 69 |nu, iUnd|o);...Di|
|00005410| 73 61 62 6c 65 49 74 65 | 6d 28 6d 65 6e 75 2c 20 |sableIte|m(menu, |
|00005420| 69 43 75 74 29 3b 0d 09 | 09 44 69 73 61 62 6c 65 |iCut);..|.Disable|
|00005430| 49 74 65 6d 28 6d 65 6e | 75 2c 20 69 43 6f 70 79 |Item(men|u, iCopy|
|00005440| 29 3b 0d 09 09 44 69 73 | 61 62 6c 65 49 74 65 6d |);...Dis|ableItem|
|00005450| 28 6d 65 6e 75 2c 20 69 | 43 6c 65 61 72 29 3b 0d |(menu, i|Clear);.|
|00005460| 09 09 44 69 73 61 62 6c | 65 49 74 65 6d 28 6d 65 |..Disabl|eItem(me|
|00005470| 6e 75 2c 20 69 50 61 73 | 74 65 29 3b 0d 09 45 4e |nu, iPas|te);..EN|
|00005480| 44 3b 0d 0d 09 6d 65 6e | 75 20 3a 3d 20 47 65 74 |D;...men|u := Get|
|00005490| 4d 48 61 6e 64 6c 65 28 | 6d 4c 69 67 68 74 29 3b |MHandle(|mLight);|
|000054a0| 0d 09 49 46 20 49 73 41 | 70 70 57 69 6e 64 6f 77 |..IF IsA|ppWindow|
|000054b0| 28 77 69 6e 64 6f 77 29 | 20 54 48 45 4e 20 42 45 |(window)| THEN BE|
|000054c0| 47 49 4e 09 09 7b 77 65 | 20 6b 6e 6f 77 20 74 68 |GIN..{we| know th|
|000054d0| 61 74 20 69 74 20 6d 75 | 73 74 20 62 65 20 74 68 |at it mu|st be th|
|000054e0| 65 20 74 72 61 66 66 69 | 63 20 6c 69 67 68 74 7d |e traffi|c light}|
|000054f0| 0d 09 09 45 6e 61 62 6c | 65 49 74 65 6d 28 6d 65 |...Enabl|eItem(me|
|00005500| 6e 75 2c 20 69 53 74 6f | 70 29 3b 0d 09 09 45 6e |nu, iSto|p);...En|
|00005510| 61 62 6c 65 49 74 65 6d | 28 6d 65 6e 75 2c 20 69 |ableItem|(menu, i|
|00005520| 47 6f 29 3b 0d 09 45 4e | 44 20 45 4c 53 45 20 42 |Go);..EN|D ELSE B|
|00005530| 45 47 49 4e 0d 09 09 44 | 69 73 61 62 6c 65 49 74 |EGIN...D|isableIt|
|00005540| 65 6d 28 6d 65 6e 75 2c | 20 69 53 74 6f 70 29 3b |em(menu,| iStop);|
|00005550| 0d 09 09 44 69 73 61 62 | 6c 65 49 74 65 6d 28 6d |...Disab|leItem(m|
|00005560| 65 6e 75 2c 20 69 47 6f | 29 3b 0d 09 45 4e 44 3b |enu, iGo|);..END;|
|00005570| 0d 09 43 68 65 63 6b 49 | 74 65 6d 28 6d 65 6e 75 |..CheckI|tem(menu|
|00005580| 2c 20 69 53 74 6f 70 2c | 20 67 53 74 6f 70 70 65 |, iStop,| gStoppe|
|00005590| 64 29 3b 09 09 7b 77 65 | 20 63 61 6e 20 61 6c 73 |d);..{we| can als|
|000055a0| 6f 20 64 65 74 65 72 6d | 69 6e 65 20 63 68 65 63 |o determ|ine chec|
|000055b0| 6b 2f 75 6e 63 68 65 63 | 6b 20 73 74 61 74 65 2c |k/unchec|k state,|
|000055c0| 20 74 6f 6f 7d 0d 09 43 | 68 65 63 6b 49 74 65 6d | too}..C|heckItem|
|000055d0| 28 6d 65 6e 75 2c 20 69 | 47 6f 2c 20 4e 4f 54 20 |(menu, i|Go, NOT |
|000055e0| 67 53 74 6f 70 70 65 64 | 29 3b 0d 45 4e 44 3b 20 |gStopped|);.END; |
|000055f0| 7b 41 64 6a 75 73 74 4d | 65 6e 75 73 7d 0d 0d 0d |{AdjustM|enus}...|
|00005600| 7b 24 53 20 4d 61 69 6e | 7d 0d 50 52 4f 43 45 44 |{$S Main|}.PROCED|
|00005610| 55 52 45 20 44 6f 4d 65 | 6e 75 43 6f 6d 6d 61 6e |URE DoMe|nuComman|
|00005620| 64 28 6d 65 6e 75 52 65 | 73 75 6c 74 3a 20 4c 4f |d(menuRe|sult: LO|
|00005630| 4e 47 49 4e 54 29 3b 0d | 0d 7b 54 68 69 73 20 69 |NGINT);.|.{This i|
|00005640| 73 20 63 61 6c 6c 65 64 | 20 77 68 65 6e 20 61 6e |s called| when an|
|00005650| 20 69 74 65 6d 20 69 73 | 20 63 68 6f 73 65 6e 20 | item is| chosen |
|00005660| 66 72 6f 6d 20 74 68 65 | 20 6d 65 6e 75 20 62 61 |from the| menu ba|
|00005670| 72 20 28 61 66 74 65 72 | 20 63 61 6c 6c 69 6e 67 |r (after| calling|
|00005680| 0d 20 4d 65 6e 75 53 65 | 6c 65 63 74 20 6f 72 20 |. MenuSe|lect or |
|00005690| 4d 65 6e 75 4b 65 79 29 | 2e 20 49 74 20 70 65 72 |MenuKey)|. It per|
|000056a0| 66 6f 72 6d 73 20 74 68 | 65 20 72 69 67 68 74 20 |forms th|e right |
|000056b0| 6f 70 65 72 61 74 69 6f | 6e 20 66 6f 72 20 65 61 |operatio|n for ea|
|000056c0| 63 68 20 63 6f 6d 6d 61 | 6e 64 2e 0d 20 49 74 20 |ch comma|nd.. It |
|000056d0| 69 73 20 67 6f 6f 64 20 | 74 6f 20 68 61 76 65 20 |is good |to have |
|000056e0| 62 6f 74 68 20 74 68 65 | 20 72 65 73 75 6c 74 20 |both the| result |
|000056f0| 6f 66 20 4d 65 6e 75 53 | 65 6c 65 63 74 20 61 6e |of MenuS|elect an|
|00005700| 64 20 4d 65 6e 75 4b 65 | 79 20 67 6f 20 74 6f 0d |d MenuKe|y go to.|
|00005710| 20 6f 6e 65 20 72 6f 75 | 74 69 6e 65 20 6c 69 6b | one rou|tine lik|
|00005720| 65 20 74 68 69 73 20 74 | 6f 20 6b 65 65 70 20 65 |e this t|o keep e|
|00005730| 76 65 72 79 74 68 69 6e | 67 20 6f 72 67 61 6e 69 |verythin|g organi|
|00005740| 7a 65 64 2e 7d 0d 0d 56 | 41 52 0d 09 6d 65 6e 75 |zed.}..V|AR..menu|
|00005750| 49 44 09 09 09 3a 20 49 | 4e 54 45 47 45 52 3b 09 |ID...: I|NTEGER;.|
|00005760| 09 7b 74 68 65 20 72 65 | 73 6f 75 72 63 65 20 49 |.{the re|source I|
|00005770| 44 20 6f 66 20 74 68 65 | 20 73 65 6c 65 63 74 65 |D of the| selecte|
|00005780| 64 20 6d 65 6e 75 7d 0d | 09 6d 65 6e 75 49 74 65 |d menu}.|.menuIte|
|00005790| 6d 09 09 3a 20 49 4e 54 | 45 47 45 52 3b 09 09 7b |m..: INT|EGER;..{|
|000057a0| 74 68 65 20 69 74 65 6d | 20 6e 75 6d 62 65 72 20 |the item| number |
|000057b0| 6f 66 20 74 68 65 20 73 | 65 6c 65 63 74 65 64 20 |of the s|elected |
|000057c0| 6d 65 6e 75 7d 0d 09 69 | 74 65 6d 48 69 74 09 09 |menu}..i|temHit..|
|000057d0| 09 3a 20 49 4e 54 45 47 | 45 52 3b 0d 09 64 61 4e |.: INTEG|ER;..daN|
|000057e0| 61 6d 65 09 09 09 3a 20 | 53 74 72 32 35 35 3b 0d |ame...: |Str255;.|
|000057f0| 09 64 61 52 65 66 4e 75 | 6d 09 09 3a 20 49 4e 54 |.daRefNu|m..: INT|
|00005800| 45 47 45 52 3b 0d 09 68 | 61 6e 64 6c 65 64 42 79 |EGER;..h|andledBy|
|00005810| 44 41 09 09 3a 20 42 4f | 4f 4c 45 41 4e 3b 0d 09 |DA..: BO|OLEAN;..|
|00005820| 69 67 6e 6f 72 65 09 09 | 09 3a 20 42 4f 4f 4c 45 |ignore..|.: BOOLE|
|00005830| 41 4e 3b 0d 0d 42 45 47 | 49 4e 0d 09 6d 65 6e 75 |AN;..BEG|IN..menu|
|00005840| 49 44 20 3a 3d 20 48 69 | 57 72 64 28 6d 65 6e 75 |ID := Hi|Wrd(menu|
|00005850| 52 65 73 75 6c 74 29 3b | 09 7b 75 73 65 20 62 75 |Result);|.{use bu|
|00005860| 69 6c 74 2d 69 6e 73 20 | 28 66 6f 72 20 65 66 66 |ilt-ins |(for eff|
|00005870| 69 63 69 65 6e 63 79 29 | 2e 2e 2e 7d 0d 09 6d 65 |iciency)|...}..me|
|00005880| 6e 75 49 74 65 6d 20 3a | 3d 20 4c 6f 57 72 64 28 |nuItem :|= LoWrd(|
|00005890| 6d 65 6e 75 52 65 73 75 | 6c 74 29 3b 09 7b 74 6f |menuResu|lt);.{to|
|000058a0| 20 67 65 74 20 6d 65 6e | 75 20 69 74 65 6d 20 6e | get men|u item n|
|000058b0| 75 6d 62 65 72 20 61 6e | 64 20 6d 65 6e 75 20 6e |umber an|d menu n|
|000058c0| 75 6d 62 65 72 7d 0d 09 | 43 41 53 45 20 6d 65 6e |umber}..|CASE men|
|000058d0| 75 49 44 20 4f 46 0d 09 | 09 6d 41 70 70 6c 65 3a |uID OF..|.mApple:|
|000058e0| 0d 09 09 09 43 41 53 45 | 20 6d 65 6e 75 49 74 65 |....CASE| menuIte|
|000058f0| 6d 20 4f 46 0d 09 09 09 | 09 69 41 62 6f 75 74 3a |m OF....|.iAbout:|
|00005900| 09 09 09 09 7b 62 72 69 | 6e 67 20 75 70 20 61 6c |....{bri|ng up al|
|00005910| 65 72 74 20 66 6f 72 20 | 41 62 6f 75 74 7d 0d 09 |ert for |About}..|
|00005920| 09 09 09 09 69 74 65 6d | 48 69 74 20 3a 3d 20 41 |....item|Hit := A|
|00005930| 6c 65 72 74 28 72 41 62 | 6f 75 74 41 6c 65 72 74 |lert(rAb|outAlert|
|00005940| 2c 20 4e 49 4c 29 3b 0d | 09 09 09 09 4f 54 48 45 |, NIL);.|....OTHE|
|00005950| 52 57 49 53 45 20 42 45 | 47 49 4e 09 09 7b 61 6c |RWISE BE|GIN..{al|
|00005960| 6c 20 6e 6f 6e 2d 41 62 | 6f 75 74 20 69 74 65 6d |l non-Ab|out item|
|00005970| 73 20 69 6e 20 74 68 69 | 73 20 6d 65 6e 75 20 61 |s in thi|s menu a|
|00005980| 72 65 20 44 41 73 7d 0d | 09 09 09 09 09 47 65 74 |re DAs}.|.....Get|
|00005990| 49 74 65 6d 28 47 65 74 | 4d 48 61 6e 64 6c 65 28 |Item(Get|MHandle(|
|000059a0| 6d 41 70 70 6c 65 29 2c | 20 6d 65 6e 75 49 74 65 |mApple),| menuIte|
|000059b0| 6d 2c 20 64 61 4e 61 6d | 65 29 3b 0d 09 09 09 09 |m, daNam|e);.....|
|000059c0| 09 64 61 52 65 66 4e 75 | 6d 20 3a 3d 20 4f 70 65 |.daRefNu|m := Ope|
|000059d0| 6e 44 65 73 6b 41 63 63 | 28 64 61 4e 61 6d 65 29 |nDeskAcc|(daName)|
|000059e0| 3b 0d 09 09 09 09 45 4e | 44 3b 0d 09 09 09 45 4e |;.....EN|D;....EN|
|000059f0| 44 3b 0d 09 09 6d 46 69 | 6c 65 3a 0d 09 09 09 43 |D;...mFi|le:....C|
|00005a00| 41 53 45 20 6d 65 6e 75 | 49 74 65 6d 20 4f 46 0d |ASE menu|Item OF.|
|00005a10| 09 09 09 09 69 43 6c 6f | 73 65 3a 0d 09 09 09 09 |....iClo|se:.....|
|00005a20| 09 69 67 6e 6f 72 65 20 | 3a 3d 20 44 6f 43 6c 6f |.ignore |:= DoClo|
|00005a30| 73 65 57 69 6e 64 6f 77 | 28 46 72 6f 6e 74 57 69 |seWindow|(FrontWi|
|00005a40| 6e 64 6f 77 29 3b 20 7b | 77 65 20 64 6f 6e 27 74 |ndow); {|we don't|
|00005a50| 20 63 61 72 65 20 69 66 | 20 63 61 6e 63 65 6c 6c | care if| cancell|
|00005a60| 65 64 7d 0d 09 09 09 09 | 69 51 75 69 74 3a 0d 09 |ed}.....|iQuit:..|
|00005a70| 09 09 09 09 54 65 72 6d | 69 6e 61 74 65 3b 0d 09 |....Term|inate;..|
|00005a80| 09 09 45 4e 44 3b 0d 09 | 09 6d 45 64 69 74 3a 09 |..END;..|.mEdit:.|
|00005a90| 09 09 09 09 09 7b 63 61 | 6c 6c 20 53 79 73 74 65 |.....{ca|ll Syste|
|00005aa0| 6d 45 64 69 74 20 66 6f | 72 20 44 41 20 65 64 69 |mEdit fo|r DA edi|
|00005ab0| 74 69 6e 67 20 26 20 4d | 75 6c 74 69 46 69 6e 64 |ting & M|ultiFind|
|00005ac0| 65 72 7d 0d 09 09 09 68 | 61 6e 64 6c 65 64 42 79 |er}....h|andledBy|
|00005ad0| 44 41 20 3a 3d 20 53 79 | 73 74 65 6d 45 64 69 74 |DA := Sy|stemEdit|
|00005ae0| 28 6d 65 6e 75 49 74 65 | 6d 2d 31 29 3b 09 7b 73 |(menuIte|m-1);.{s|
|00005af0| 69 6e 63 65 20 77 65 20 | 64 6f 6e 27 74 20 64 6f |ince we |don't do|
|00005b00| 20 61 6e 79 20 65 64 69 | 74 69 6e 67 7d 0d 09 09 | any edi|ting}...|
|00005b10| 6d 4c 69 67 68 74 3a 0d | 09 09 09 43 41 53 45 20 |mLight:.|...CASE |
|00005b20| 6d 65 6e 75 49 74 65 6d | 20 4f 46 0d 09 09 09 09 |menuItem| OF.....|
|00005b30| 69 53 74 6f 70 3a 0d 09 | 09 09 09 09 53 65 74 4c |iStop:..|....SetL|
|00005b40| 69 67 68 74 28 46 72 6f | 6e 74 57 69 6e 64 6f 77 |ight(Fro|ntWindow|
|00005b50| 2c 20 54 52 55 45 29 3b | 0d 09 09 09 09 69 47 6f |, TRUE);|.....iGo|
|00005b60| 3a 0d 09 09 09 09 09 53 | 65 74 4c 69 67 68 74 28 |:......S|etLight(|
|00005b70| 46 72 6f 6e 74 57 69 6e | 64 6f 77 2c 20 46 41 4c |FrontWin|dow, FAL|
|00005b80| 53 45 29 3b 0d 09 09 09 | 45 4e 44 3b 0d 09 45 4e |SE);....|END;..EN|
|00005b90| 44 3b 0d 09 48 69 6c 69 | 74 65 4d 65 6e 75 28 30 |D;..Hili|teMenu(0|
|00005ba0| 29 3b 09 09 09 09 09 7b | 75 6e 68 69 67 68 6c 69 |);.....{|unhighli|
|00005bb0| 67 68 74 20 77 68 61 74 | 20 4d 65 6e 75 53 65 6c |ght what| MenuSel|
|00005bc0| 65 63 74 20 28 6f 72 20 | 4d 65 6e 75 4b 65 79 29 |ect (or |MenuKey)|
|00005bd0| 20 68 69 6c 69 74 65 64 | 7d 0d 45 4e 44 3b 20 7b | hilited|}.END; {|
|00005be0| 44 6f 4d 65 6e 75 43 6f | 6d 6d 61 6e 64 7d 0d 0d |DoMenuCo|mmand}..|
|00005bf0| 0d 7b 24 53 20 4d 61 69 | 6e 7d 0d 50 52 4f 43 45 |.{$S Mai|n}.PROCE|
|00005c00| 44 55 52 45 20 44 72 61 | 77 57 69 6e 64 6f 77 28 |DURE Dra|wWindow(|
|00005c10| 77 69 6e 64 6f 77 3a 20 | 57 69 6e 64 6f 77 50 74 |window: |WindowPt|
|00005c20| 72 29 3b 0d 0d 7b 44 72 | 61 77 20 74 68 65 20 63 |r);..{Dr|aw the c|
|00005c30| 6f 6e 74 65 6e 74 73 20 | 6f 66 20 74 68 65 20 61 |ontents |of the a|
|00005c40| 70 70 6c 69 63 61 74 69 | 6f 6e 20 77 69 6e 64 6f |pplicati|on windo|
|00005c50| 77 2e 20 57 65 20 64 6f | 20 73 6f 6d 65 20 64 72 |w. We do| some dr|
|00005c60| 61 77 69 6e 67 20 69 6e | 20 63 6f 6c 6f 72 2c 20 |awing in| color, |
|00005c70| 75 73 69 6e 67 0d 20 43 | 6c 61 73 73 69 63 20 51 |using. C|lassic Q|
|00005c80| 75 69 63 6b 44 72 61 77 | 27 73 20 63 6f 6c 6f 72 |uickDraw|'s color|
|00005c90| 20 63 61 70 61 62 69 6c | 69 74 69 65 73 2e 20 54 | capabil|ities. T|
|00005ca0| 68 69 73 20 77 69 6c 6c | 20 62 65 20 62 6c 61 63 |his will| be blac|
|00005cb0| 6b 20 61 6e 64 20 77 68 | 69 74 65 20 6f 6e 20 6f |k and wh|ite on o|
|00005cc0| 6c 64 0d 20 6d 61 63 68 | 69 6e 65 73 2c 20 62 75 |ld. mach|ines, bu|
|00005cd0| 74 20 63 6f 6c 6f 72 20 | 6f 6e 20 63 6f 6c 6f 72 |t color |on color|
|00005ce0| 20 6d 61 63 68 69 6e 65 | 73 2e 20 41 74 20 74 68 | machine|s. At th|
|00005cf0| 69 73 20 70 6f 69 6e 74 | 2c 20 74 68 65 20 77 69 |is point|, the wi|
|00005d00| 6e 64 6f 77 27 73 20 76 | 69 73 52 67 6e 20 69 73 |ndow's v|isRgn is|
|00005d10| 0d 20 73 65 74 20 74 6f | 20 61 6c 6c 6f 77 20 64 |. set to| allow d|
|00005d20| 72 61 77 69 6e 67 20 6f | 6e 6c 79 20 77 68 65 72 |rawing o|nly wher|
|00005d30| 65 20 69 74 20 6e 65 65 | 64 73 20 74 6f 20 62 65 |e it nee|ds to be|
|00005d40| 20 64 6f 6e 65 2e 7d 0d | 0d 42 45 47 49 4e 0d 09 | done.}.|.BEGIN..|
|00005d50| 53 65 74 50 6f 72 74 28 | 77 69 6e 64 6f 77 29 3b |SetPort(|window);|
|00005d60| 0d 0d 09 45 72 61 73 65 | 52 65 63 74 28 77 69 6e |...Erase|Rect(win|
|00005d70| 64 6f 77 5e 2e 70 6f 72 | 74 52 65 63 74 29 3b 09 |dow^.por|tRect);.|
|00005d80| 7b 63 6c 65 61 72 20 6f | 75 74 20 61 6e 79 20 67 |{clear o|ut any g|
|00005d90| 61 72 62 61 67 65 20 74 | 68 61 74 20 6d 69 67 68 |arbage t|hat migh|
|00005da0| 74 20 62 65 20 6c 65 66 | 74 20 62 65 68 69 6e 64 |t be lef|t behind|
|00005db0| 7d 0d 09 49 46 20 67 53 | 74 6f 70 70 65 64 20 54 |}..IF gS|topped T|
|00005dc0| 48 45 4e 09 09 09 09 7b | 64 72 61 77 20 61 20 72 |HEN....{|draw a r|
|00005dd0| 65 64 20 28 6f 72 20 77 | 68 69 74 65 29 20 73 74 |ed (or w|hite) st|
|00005de0| 6f 70 20 6c 69 67 68 74 | 7d 0d 09 09 46 6f 72 65 |op light|}...Fore|
|00005df0| 43 6f 6c 6f 72 28 72 65 | 64 43 6f 6c 6f 72 29 0d |Color(re|dColor).|
|00005e00| 09 45 4c 53 45 0d 09 09 | 46 6f 72 65 43 6f 6c 6f |.ELSE...|ForeColo|
|00005e10| 72 28 77 68 69 74 65 43 | 6f 6c 6f 72 29 3b 0d 09 |r(whiteC|olor);..|
|00005e20| 50 61 69 6e 74 4f 76 61 | 6c 28 67 53 74 6f 70 52 |PaintOva|l(gStopR|
|00005e30| 65 63 74 29 3b 0d 09 46 | 6f 72 65 43 6f 6c 6f 72 |ect);..F|oreColor|
|00005e40| 28 62 6c 61 63 6b 43 6f | 6c 6f 72 29 3b 0d 09 46 |(blackCo|lor);..F|
|00005e50| 72 61 6d 65 4f 76 61 6c | 28 67 53 74 6f 70 52 65 |rameOval|(gStopRe|
|00005e60| 63 74 29 3b 0d 09 49 46 | 20 4e 4f 54 20 67 53 74 |ct);..IF| NOT gSt|
|00005e70| 6f 70 70 65 64 20 54 48 | 45 4e 09 09 09 7b 64 72 |opped TH|EN...{dr|
|00005e80| 61 77 20 61 20 67 72 65 | 65 6e 20 28 6f 72 20 77 |aw a gre|en (or w|
|00005e90| 68 69 74 65 29 20 67 6f | 20 6c 69 67 68 74 7d 0d |hite) go| light}.|
|00005ea0| 09 09 46 6f 72 65 43 6f | 6c 6f 72 28 67 72 65 65 |..ForeCo|lor(gree|
|00005eb0| 6e 43 6f 6c 6f 72 29 0d | 09 45 4c 53 45 0d 09 09 |nColor).|.ELSE...|
|00005ec0| 46 6f 72 65 43 6f 6c 6f | 72 28 77 68 69 74 65 43 |ForeColo|r(whiteC|
|00005ed0| 6f 6c 6f 72 29 3b 0d 09 | 50 61 69 6e 74 4f 76 61 |olor);..|PaintOva|
|00005ee0| 6c 28 67 47 6f 52 65 63 | 74 29 3b 0d 09 46 6f 72 |l(gGoRec|t);..For|
|00005ef0| 65 43 6f 6c 6f 72 28 62 | 6c 61 63 6b 43 6f 6c 6f |eColor(b|lackColo|
|00005f00| 72 29 3b 0d 09 46 72 61 | 6d 65 4f 76 61 6c 28 67 |r);..Fra|meOval(g|
|00005f10| 47 6f 52 65 63 74 29 3b | 0d 45 4e 44 3b 20 7b 44 |GoRect);|.END; {D|
|00005f20| 72 61 77 57 69 6e 64 6f | 77 7d 0d 0d 0d 7b 24 53 |rawWindo|w}...{$S|
|00005f30| 20 4d 61 69 6e 7d 0d 50 | 52 4f 43 45 44 55 52 45 | Main}.P|ROCEDURE|
|00005f40| 20 44 6f 43 6f 6e 74 65 | 6e 74 43 6c 69 63 6b 28 | DoConte|ntClick(|
|00005f50| 77 69 6e 64 6f 77 3a 20 | 57 69 6e 64 6f 77 50 74 |window: |WindowPt|
|00005f60| 72 3b 20 65 76 65 6e 74 | 3a 20 45 76 65 6e 74 52 |r; event|: EventR|
|00005f70| 65 63 6f 72 64 29 3b 0d | 0d 7b 54 68 69 73 20 69 |ecord);.|.{This i|
|00005f80| 73 20 63 61 6c 6c 65 64 | 20 77 68 65 6e 20 61 20 |s called| when a |
|00005f90| 6d 6f 75 73 65 2d 64 6f | 77 6e 20 65 76 65 6e 74 |mouse-do|wn event|
|00005fa0| 20 6f 63 63 75 72 73 20 | 69 6e 20 74 68 65 20 63 | occurs |in the c|
|00005fb0| 6f 6e 74 65 6e 74 20 6f | 66 20 61 20 77 69 6e 64 |ontent o|f a wind|
|00005fc0| 6f 77 2e 0d 20 4f 74 68 | 65 72 20 61 70 70 6c 69 |ow.. Oth|er appli|
|00005fd0| 63 61 74 69 6f 6e 73 20 | 6d 69 67 68 74 20 77 61 |cations |might wa|
|00005fe0| 6e 74 20 74 6f 20 63 61 | 6c 6c 20 46 69 6e 64 43 |nt to ca|ll FindC|
|00005ff0| 6f 6e 74 72 6f 6c 2c 20 | 54 45 43 6c 69 63 6b 2c |ontrol, |TEClick,|
|00006000| 20 65 74 63 2e 2c 20 74 | 6f 0d 20 66 75 72 74 68 | etc., t|o. furth|
|00006010| 65 72 20 70 72 6f 63 65 | 73 73 20 74 68 65 20 63 |er proce|ss the c|
|00006020| 6c 69 63 6b 2e 7d 0d 0d | 42 45 47 49 4e 0d 09 53 |lick.}..|BEGIN..S|
|00006030| 65 74 4c 69 67 68 74 28 | 77 69 6e 64 6f 77 2c 20 |etLight(|window, |
|00006040| 4e 4f 54 20 67 53 74 6f | 70 70 65 64 29 3b 0d 45 |NOT gSto|pped);.E|
|00006050| 4e 44 3b 20 7b 44 6f 43 | 6f 6e 74 65 6e 74 43 6c |ND; {DoC|ontentCl|
|00006060| 69 63 6b 7d 0d 0d 0d 7b | 24 53 20 4d 61 69 6e 7d |ick}...{|$S Main}|
|00006070| 0d 50 52 4f 43 45 44 55 | 52 45 20 44 6f 55 70 64 |.PROCEDU|RE DoUpd|
|00006080| 61 74 65 28 77 69 6e 64 | 6f 77 3a 20 57 69 6e 64 |ate(wind|ow: Wind|
|00006090| 6f 77 50 74 72 29 3b 0d | 0d 7b 54 68 69 73 20 69 |owPtr);.|.{This i|
|000060a0| 73 20 63 61 6c 6c 65 64 | 20 77 68 65 6e 20 61 6e |s called| when an|
|000060b0| 20 75 70 64 61 74 65 20 | 65 76 65 6e 74 20 69 73 | update |event is|
|000060c0| 20 72 65 63 65 69 76 65 | 64 20 66 6f 72 20 61 20 | receive|d for a |
|000060d0| 77 69 6e 64 6f 77 2e 0d | 20 49 74 20 63 61 6c 6c |window..| It call|
|000060e0| 73 20 44 72 61 77 57 69 | 6e 64 6f 77 20 74 6f 20 |s DrawWi|ndow to |
|000060f0| 64 72 61 77 20 74 68 65 | 20 63 6f 6e 74 65 6e 74 |draw the| content|
|00006100| 73 20 6f 66 20 61 6e 20 | 61 70 70 6c 69 63 61 74 |s of an |applicat|
|00006110| 69 6f 6e 20 77 69 6e 64 | 6f 77 2e 0d 20 41 73 20 |ion wind|ow.. As |
|00006120| 61 6e 20 65 66 66 65 63 | 69 65 6e 63 79 20 6d 65 |an effec|iency me|
|00006130| 61 73 75 72 65 20 74 68 | 61 74 20 64 6f 65 73 20 |asure th|at does |
|00006140| 6e 6f 74 20 68 61 76 65 | 20 74 6f 20 62 65 20 66 |not have| to be f|
|00006150| 6f 6c 6c 6f 77 65 64 2c | 20 69 74 0d 20 63 61 6c |ollowed,| it. cal|
|00006160| 6c 73 20 74 68 65 20 64 | 72 61 77 69 6e 67 20 72 |ls the d|rawing r|
|00006170| 6f 75 74 69 6e 65 20 6f | 6e 6c 79 20 69 66 20 74 |outine o|nly if t|
|00006180| 68 65 20 76 69 73 52 67 | 6e 20 69 73 20 6e 6f 6e |he visRg|n is non|
|00006190| 2d 65 6d 70 74 79 2e 20 | 54 68 69 73 0d 20 77 69 |-empty. |This. wi|
|000061a0| 6c 6c 20 68 61 6e 64 6c | 65 20 73 69 74 75 61 74 |ll handl|e situat|
|000061b0| 69 6f 6e 73 20 77 68 65 | 72 65 20 63 61 6c 63 75 |ions whe|re calcu|
|000061c0| 6c 61 74 69 6f 6e 73 20 | 66 6f 72 20 64 72 61 77 |lations |for draw|
|000061d0| 69 6e 67 20 6f 72 20 64 | 72 61 77 69 6e 67 0d 20 |ing or d|rawing. |
|000061e0| 69 74 73 65 6c 66 20 69 | 73 20 76 65 72 79 20 74 |itself i|s very t|
|000061f0| 69 6d 65 2d 63 6f 6e 73 | 75 6d 69 6e 67 2e 7d 0d |ime-cons|uming.}.|
|00006200| 0d 42 45 47 49 4e 0d 09 | 49 46 20 49 73 41 70 70 |.BEGIN..|IF IsApp|
|00006210| 57 69 6e 64 6f 77 28 77 | 69 6e 64 6f 77 29 20 54 |Window(w|indow) T|
|00006220| 48 45 4e 20 42 45 47 49 | 4e 0d 09 09 42 65 67 69 |HEN BEGI|N...Begi|
|00006230| 6e 55 70 64 61 74 65 28 | 77 69 6e 64 6f 77 29 3b |nUpdate(|window);|
|00006240| 09 09 09 09 09 7b 73 65 | 74 73 20 75 70 20 74 68 |.....{se|ts up th|
|00006250| 65 20 76 69 73 52 67 6e | 2c 20 63 6c 65 61 72 73 |e visRgn|, clears|
|00006260| 20 75 70 64 61 74 65 52 | 67 6e 7d 0d 09 09 49 46 | updateR|gn}...IF|
|00006270| 20 4e 4f 54 20 45 6d 70 | 74 79 52 67 6e 28 77 69 | NOT Emp|tyRgn(wi|
|00006280| 6e 64 6f 77 5e 2e 76 69 | 73 52 67 6e 29 20 54 48 |ndow^.vi|sRgn) TH|
|00006290| 45 4e 09 7b 64 72 61 77 | 20 69 66 20 75 70 64 61 |EN.{draw| if upda|
|000062a0| 74 69 6e 67 20 6e 65 65 | 64 73 20 74 6f 20 62 65 |ting nee|ds to be|
|000062b0| 20 64 6f 6e 65 7d 0d 09 | 09 09 44 72 61 77 57 69 | done}..|..DrawWi|
|000062c0| 6e 64 6f 77 28 77 69 6e | 64 6f 77 29 3b 0d 09 09 |ndow(win|dow);...|
|000062d0| 45 6e 64 55 70 64 61 74 | 65 28 77 69 6e 64 6f 77 |EndUpdat|e(window|
|000062e0| 29 3b 09 09 09 09 09 09 | 7b 72 65 73 74 6f 72 65 |);......|{restore|
|000062f0| 73 20 74 68 65 20 76 69 | 73 52 67 6e 7d 0d 09 45 |s the vi|sRgn}..E|
|00006300| 4e 44 3b 0d 45 4e 44 3b | 20 7b 44 6f 55 70 64 61 |ND;.END;| {DoUpda|
|00006310| 74 65 7d 0d 0d 0d 7b 24 | 53 20 4d 61 69 6e 7d 0d |te}...{$|S Main}.|
|00006320| 50 52 4f 43 45 44 55 52 | 45 20 44 6f 41 63 74 69 |PROCEDUR|E DoActi|
|00006330| 76 61 74 65 28 77 69 6e | 64 6f 77 3a 20 57 69 6e |vate(win|dow: Win|
|00006340| 64 6f 77 50 74 72 3b 20 | 62 65 63 6f 6d 69 6e 67 |dowPtr; |becoming|
|00006350| 41 63 74 69 76 65 3a 20 | 42 4f 4f 4c 45 41 4e 29 |Active: |BOOLEAN)|
|00006360| 3b 0d 0d 7b 54 68 69 73 | 20 69 73 20 63 61 6c 6c |;..{This| is call|
|00006370| 65 64 20 77 68 65 6e 20 | 61 20 77 69 6e 64 6f 77 |ed when |a window|
|00006380| 20 69 73 20 61 63 74 69 | 76 61 74 65 64 20 6f 72 | is acti|vated or|
|00006390| 20 64 65 61 63 74 69 76 | 61 74 65 64 2e 0d 20 49 | deactiv|ated.. I|
|000063a0| 6e 20 53 61 6d 70 6c 65 | 2c 20 74 68 65 20 57 69 |n Sample|, the Wi|
|000063b0| 6e 64 6f 77 20 4d 61 6e | 61 67 65 72 27 73 20 68 |ndow Man|ager's h|
|000063c0| 61 6e 64 6c 69 6e 67 20 | 6f 66 20 61 63 74 69 76 |andling |of activ|
|000063d0| 61 74 65 20 61 6e 64 0d | 20 64 65 61 63 74 69 76 |ate and.| deactiv|
|000063e0| 61 74 65 20 65 76 65 6e | 74 73 20 69 73 20 73 75 |ate even|ts is su|
|000063f0| 66 66 69 63 69 65 6e 74 | 2e 20 4f 74 68 65 72 20 |fficient|. Other |
+--------+-------------------------+-------------------------+--------+--------+
Only 25.0 KB of data is shown above.